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 |
|---|---|
| 3314 | |
| 3315 | // Make sure we have a valid post status |
| 3316 | if ( !in_array($post_status, get_post_stati()) ) |
| 3317 | return false; |
| 3318 | |
| 3319 | $cache = array(); |
| 3320 | $key = md5( serialize( compact(array_keys($defaults)) ) ); |
| 3321 | if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { |
| 3322 | if ( is_array($cache) && isset( $cache[ $key ] ) ) { |
| 3323 | $pages = apply_filters('get_pages', $cache[ $key ], $r ); |
| 3324 | return $pages; |
| 3325 | } |
| 3326 | } |
| 3327 | |
| 3328 | if ( !is_array($cache) ) |
| 3329 | $cache = array(); |
| 3330 | |
| 3331 | $inclusions = ''; |
| 3332 | if ( !empty($include) ) { |
| Line | Code |
| 3414 | $query .= $author_query; |
| 3415 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
| 3416 | |
| 3417 | if ( !empty($number) ) |
| 3418 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 3419 | |
| 3420 | $pages = $wpdb->get_results($query); |
| 3421 | |
| 3422 | if ( empty($pages) ) { |
| 3423 | $pages = apply_filters('get_pages', array(), $r); |
| 3424 | return $pages; |
| 3425 | } |
| 3426 | |
| 3427 | // Sanitize before caching so it'll only get done once |
| 3428 | $num_pages = count($pages); |
| 3429 | for ($i = 0; $i < $num_pages; $i++) { |
| 3430 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 3431 | } |
| 3432 | |
| Line | Code |
| 3447 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 3448 | if ( in_array($pages[$i]->ID, $excludes) ) |
| 3449 | unset($pages[$i]); |
| 3450 | } |
| 3451 | } |
| 3452 | |
| 3453 | $cache[ $key ] = $pages; |
| 3454 | wp_cache_set( 'get_pages', $cache, 'posts' ); |
| 3455 | |
| 3456 | $pages = apply_filters('get_pages', $pages, $r); |
| 3457 | |
| 3458 | return $pages; |
| 3459 | } |
| 3460 | |
| 3461 | // |
| 3462 | // Attachment functions |
| 3463 | // |
| 3464 | |
| 3465 | /** |