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 |
|---|---|
| 5065 | $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) ); |
| 5066 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
| 5067 | |
| 5068 | $cache_key = "get_pages:$key:$last_changed"; |
| 5069 | $cache = wp_cache_get( $cache_key, 'posts' ); |
| 5070 | if ( false !== $cache ) { |
| 5071 | // Convert to WP_Post instances. |
| 5072 | $pages = array_map( 'get_post', $cache ); |
| 5073 | /** This filter is documented in wp-includes/post.php */ |
| 5074 | $pages = apply_filters( 'get_pages', $pages, $r ); |
| 5075 | return $pages; |
| 5076 | } |
| 5077 | |
| 5078 | $inclusions = ''; |
| 5079 | if ( ! empty( $r['include'] ) ) { |
| 5080 | $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include |
| 5081 | $parent = -1; |
| 5082 | $exclude = ''; |
| 5083 | $meta_key = ''; |
| Line | Code |
| 5225 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 5226 | } |
| 5227 | |
| 5228 | $pages = $wpdb->get_results( $query ); |
| 5229 | |
| 5230 | if ( empty( $pages ) ) { |
| 5231 | wp_cache_set( $cache_key, array(), 'posts' ); |
| 5232 | |
| 5233 | /** This filter is documented in wp-includes/post.php */ |
| 5234 | $pages = apply_filters( 'get_pages', array(), $r ); |
| 5235 | return $pages; |
| 5236 | } |
| 5237 | |
| 5238 | // Sanitize before caching so it'll only get done once. |
| 5239 | $num_pages = count( $pages ); |
| 5240 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 5241 | $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); |
| 5242 | } |
| 5243 | |
| Line | Code |
| 5277 | |
| 5278 | /** |
| 5279 | * Filters the retrieved list of pages. |
| 5280 | * |
| 5281 | * @since 2.1.0 |
| 5282 | * |
| 5283 | * @param array $pages List of pages to retrieve. |
| 5284 | * @param array $r Array of get_pages() arguments. |
| 5285 | */ |
| 5286 | return apply_filters( 'get_pages', $pages, $r ); |
| 5287 | } |
| 5288 | |
| 5289 | // |
| 5290 | // Attachment functions |
| 5291 | // |
| 5292 | |
| 5293 | /** |
| 5294 | * Determines whether an attachment URI is local and really an attachment. |
| 5295 | * |