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 |
|---|---|
| 3397 | if ( !is_array( $post_status ) ) |
| 3398 | $post_status = explode( ',', $post_status ); |
| 3399 | if ( array_diff( $post_status, get_post_stati() ) ) |
| 3400 | return false; |
| 3401 | |
| 3402 | $cache = array(); |
| 3403 | $key = md5( serialize( compact(array_keys($defaults)) ) ); |
| 3404 | if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { |
| 3405 | if ( is_array($cache) && isset( $cache[ $key ] ) ) { |
| 3406 | $pages = apply_filters('get_pages', $cache[ $key ], $r ); |
| 3407 | return $pages; |
| 3408 | } |
| 3409 | } |
| 3410 | |
| 3411 | if ( !is_array($cache) ) |
| 3412 | $cache = array(); |
| 3413 | |
| 3414 | $inclusions = ''; |
| 3415 | if ( !empty($include) ) { |
| Line | Code |
| 3539 | $query .= $author_query; |
| 3540 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
| 3541 | |
| 3542 | if ( !empty($number) ) |
| 3543 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 3544 | |
| 3545 | $pages = $wpdb->get_results($query); |
| 3546 | |
| 3547 | if ( empty($pages) ) { |
| 3548 | $pages = apply_filters('get_pages', array(), $r); |
| 3549 | return $pages; |
| 3550 | } |
| 3551 | |
| 3552 | // Sanitize before caching so it'll only get done once |
| 3553 | $num_pages = count($pages); |
| 3554 | for ($i = 0; $i < $num_pages; $i++) { |
| 3555 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 3556 | } |
| 3557 | |
| Line | Code |
| 3572 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 3573 | if ( in_array($pages[$i]->ID, $excludes) ) |
| 3574 | unset($pages[$i]); |
| 3575 | } |
| 3576 | } |
| 3577 | |
| 3578 | $cache[ $key ] = $pages; |
| 3579 | wp_cache_set( 'get_pages', $cache, 'posts' ); |
| 3580 | |
| 3581 | $pages = apply_filters('get_pages', $pages, $r); |
| 3582 | |
| 3583 | return $pages; |
| 3584 | } |
| 3585 | |
| 3586 | // |
| 3587 | // Attachment functions |
| 3588 | // |
| 3589 | |
| 3590 | /** |