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 |
|---|---|
| 3350 | if ( !is_array( $post_status ) ) |
| 3351 | $post_status = explode( ',', $post_status ); |
| 3352 | if ( array_diff( $post_status, get_post_stati() ) ) |
| 3353 | return false; |
| 3354 | |
| 3355 | $cache = array(); |
| 3356 | $key = md5( serialize( compact(array_keys($defaults)) ) ); |
| 3357 | if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { |
| 3358 | if ( is_array($cache) && isset( $cache[ $key ] ) ) { |
| 3359 | $pages = apply_filters('get_pages', $cache[ $key ], $r ); |
| 3360 | return $pages; |
| 3361 | } |
| 3362 | } |
| 3363 | |
| 3364 | if ( !is_array($cache) ) |
| 3365 | $cache = array(); |
| 3366 | |
| 3367 | $inclusions = ''; |
| 3368 | if ( !empty($include) ) { |
| Line | Code |
| 3492 | $query .= $author_query; |
| 3493 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
| 3494 | |
| 3495 | if ( !empty($number) ) |
| 3496 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 3497 | |
| 3498 | $pages = $wpdb->get_results($query); |
| 3499 | |
| 3500 | if ( empty($pages) ) { |
| 3501 | $pages = apply_filters('get_pages', array(), $r); |
| 3502 | return $pages; |
| 3503 | } |
| 3504 | |
| 3505 | // Sanitize before caching so it'll only get done once |
| 3506 | $num_pages = count($pages); |
| 3507 | for ($i = 0; $i < $num_pages; $i++) { |
| 3508 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 3509 | } |
| 3510 | |
| Line | Code |
| 3525 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 3526 | if ( in_array($pages[$i]->ID, $excludes) ) |
| 3527 | unset($pages[$i]); |
| 3528 | } |
| 3529 | } |
| 3530 | |
| 3531 | $cache[ $key ] = $pages; |
| 3532 | wp_cache_set( 'get_pages', $cache, 'posts' ); |
| 3533 | |
| 3534 | $pages = apply_filters('get_pages', $pages, $r); |
| 3535 | |
| 3536 | return $pages; |
| 3537 | } |
| 3538 | |
| 3539 | // |
| 3540 | // Attachment functions |
| 3541 | // |
| 3542 | |
| 3543 | /** |