WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 6028 | |
| 6029 | $cache_key = "get_pages:$key:$last_changed"; |
| 6030 | $cache = wp_cache_get( $cache_key, 'posts' ); |
| 6031 | if ( false !== $cache ) { |
| 6032 | _prime_post_caches( $cache, false, false ); |
| 6033 | |
| 6034 | // Convert to WP_Post instances. |
| 6035 | $pages = array_map( 'get_post', $cache ); |
| 6036 | /** This filter is documented in wp-includes/post.php */ |
| 6037 | $pages = apply_filters( 'get_pages', $pages, $parsed_args ); |
| 6038 | |
| 6039 | return $pages; |
| 6040 | } |
| 6041 | |
| 6042 | $inclusions = ''; |
| 6043 | if ( ! empty( $parsed_args['include'] ) ) { |
| 6044 | $child_of = 0; // Ignore child_of, parent, exclude, meta_key, and meta_value params if using include. |
| 6045 | $parent = -1; |
| 6046 | $exclude = ''; |
| Line | Code |
| 6189 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 6190 | } |
| 6191 | |
| 6192 | $pages = $wpdb->get_results( $query ); |
| 6193 | |
| 6194 | if ( empty( $pages ) ) { |
| 6195 | wp_cache_set( $cache_key, array(), 'posts' ); |
| 6196 | |
| 6197 | /** This filter is documented in wp-includes/post.php */ |
| 6198 | $pages = apply_filters( 'get_pages', array(), $parsed_args ); |
| 6199 | |
| 6200 | return $pages; |
| 6201 | } |
| 6202 | |
| 6203 | // Sanitize before caching so it'll only get done once. |
| 6204 | $num_pages = count( $pages ); |
| 6205 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 6206 | $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); |
| 6207 | } |
| Line | Code |
| 6242 | |
| 6243 | /** |
| 6244 | * Filters the retrieved list of pages. |
| 6245 | * |
| 6246 | * @since 2.1.0 |
| 6247 | * |
| 6248 | * @param WP_Post[] $pages Array of page objects. |
| 6249 | * @param array $parsed_args Array of get_pages() arguments. |
| 6250 | */ |
| 6251 | return apply_filters( 'get_pages', $pages, $parsed_args ); |
| 6252 | } |
| 6253 | |
| 6254 | // |
| 6255 | // Attachment functions. |
| 6256 | // |
| 6257 | |
| 6258 | /** |
| 6259 | * Determines whether an attachment URI is local and really an attachment. |
| 6260 | * |