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 |
|---|---|
| 3636 | if ( array_diff( $post_status, get_post_stati() ) ) |
| 3637 | return $pages; |
| 3638 | |
| 3639 | $cache = array(); |
| 3640 | $key = md5( serialize( compact(array_keys($defaults)) ) ); |
| 3641 | if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { |
| 3642 | if ( is_array($cache) && isset( $cache[ $key ] ) && is_array( $cache[ $key ] ) ) { |
| 3643 | // Convert to WP_Post instances |
| 3644 | $pages = array_map( 'get_post', $cache[ $key ] ); |
| 3645 | $pages = apply_filters( 'get_pages', $pages, $r ); |
| 3646 | return $pages; |
| 3647 | } |
| 3648 | } |
| 3649 | |
| 3650 | if ( !is_array($cache) ) |
| 3651 | $cache = array(); |
| 3652 | |
| 3653 | $inclusions = ''; |
| 3654 | if ( !empty($include) ) { |
| Line | Code |
| 3778 | $query .= $author_query; |
| 3779 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
| 3780 | |
| 3781 | if ( !empty($number) ) |
| 3782 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 3783 | |
| 3784 | $pages = $wpdb->get_results($query); |
| 3785 | |
| 3786 | if ( empty($pages) ) { |
| 3787 | $pages = apply_filters('get_pages', array(), $r); |
| 3788 | return $pages; |
| 3789 | } |
| 3790 | |
| 3791 | // Sanitize before caching so it'll only get done once |
| 3792 | $num_pages = count($pages); |
| 3793 | for ($i = 0; $i < $num_pages; $i++) { |
| 3794 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 3795 | } |
| 3796 | |
| Line | Code |
| 3814 | } |
| 3815 | } |
| 3816 | |
| 3817 | $cache[ $key ] = $pages; |
| 3818 | wp_cache_set( 'get_pages', $cache, 'posts' ); |
| 3819 | |
| 3820 | // Convert to WP_Post instances |
| 3821 | $pages = array_map( 'get_post', $pages ); |
| 3822 | |
| 3823 | $pages = apply_filters('get_pages', $pages, $r); |
| 3824 | |
| 3825 | return $pages; |
| 3826 | } |
| 3827 | |
| 3828 | // |
| 3829 | // Attachment functions |
| 3830 | // |
| 3831 | |
| 3832 | /** |