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 |
|---|---|
| 6000 | |
| 6001 | $cache_key = "get_pages:$key:$last_changed"; |
| 6002 | $cache = wp_cache_get( $cache_key, 'posts' ); |
| 6003 | if ( false !== $cache ) { |
| 6004 | _prime_post_caches( $cache, false, false ); |
| 6005 | |
| 6006 | // Convert to WP_Post instances. |
| 6007 | $pages = array_map( 'get_post', $cache ); |
| 6008 | /** This filter is documented in wp-includes/post.php */ |
| 6009 | $pages = apply_filters( 'get_pages', $pages, $parsed_args ); |
| 6010 | |
| 6011 | return $pages; |
| 6012 | } |
| 6013 | |
| 6014 | $inclusions = ''; |
| 6015 | if ( ! empty( $parsed_args['include'] ) ) { |
| 6016 | $child_of = 0; // Ignore child_of, parent, exclude, meta_key, and meta_value params if using include. |
| 6017 | $parent = -1; |
| 6018 | $exclude = ''; |
| Line | Code |
| 6161 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 6162 | } |
| 6163 | |
| 6164 | $pages = $wpdb->get_results( $query ); |
| 6165 | |
| 6166 | if ( empty( $pages ) ) { |
| 6167 | wp_cache_set( $cache_key, array(), 'posts' ); |
| 6168 | |
| 6169 | /** This filter is documented in wp-includes/post.php */ |
| 6170 | $pages = apply_filters( 'get_pages', array(), $parsed_args ); |
| 6171 | |
| 6172 | return $pages; |
| 6173 | } |
| 6174 | |
| 6175 | // Sanitize before caching so it'll only get done once. |
| 6176 | $num_pages = count( $pages ); |
| 6177 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 6178 | $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); |
| 6179 | } |
| Line | Code |
| 6214 | |
| 6215 | /** |
| 6216 | * Filters the retrieved list of pages. |
| 6217 | * |
| 6218 | * @since 2.1.0 |
| 6219 | * |
| 6220 | * @param WP_Post[] $pages Array of page objects. |
| 6221 | * @param array $parsed_args Array of get_pages() arguments. |
| 6222 | */ |
| 6223 | return apply_filters( 'get_pages', $pages, $parsed_args ); |
| 6224 | } |
| 6225 | |
| 6226 | // |
| 6227 | // Attachment functions. |
| 6228 | // |
| 6229 | |
| 6230 | /** |
| 6231 | * Determines whether an attachment URI is local and really an attachment. |
| 6232 | * |