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 |
---|---|
5680 | $key = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) ); |
5681 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
5682 |
|
5683 | $cache_key = "get_pages:$key:$last_changed"; |
5684 | $cache = wp_cache_get( $cache_key, 'posts' ); |
5685 | if ( false !== $cache ) { |
5686 | // Convert to WP_Post instances. |
5687 | $pages = array_map( 'get_post', $cache ); |
5688 | /** This filter is documented in wp-includes/post.php */ |
5689 | $pages = apply_filters( 'get_pages', $pages, $parsed_args ); |
5690 | return $pages; |
5691 | } |
5692 |
|
5693 | $inclusions = ''; |
5694 | if ( ! empty( $parsed_args['include'] ) ) { |
5695 | $child_of = 0; // Ignore child_of, parent, exclude, meta_key, and meta_value params if using include. |
5696 | $parent = -1; |
5697 | $exclude = ''; |
5698 | $meta_key = ''; |
Line | Code |
5840 | $query .= ' LIMIT ' . $offset . ',' . $number; |
5841 | } |
5842 |
|
5843 | $pages = $wpdb->get_results( $query ); |
5844 |
|
5845 | if ( empty( $pages ) ) { |
5846 | wp_cache_set( $cache_key, array(), 'posts' ); |
5847 |
|
5848 | /** This filter is documented in wp-includes/post.php */ |
5849 | $pages = apply_filters( 'get_pages', array(), $parsed_args ); |
5850 | return $pages; |
5851 | } |
5852 |
|
5853 | // Sanitize before caching so it'll only get done once. |
5854 | $num_pages = count( $pages ); |
5855 | for ( $i = 0; $i < $num_pages; $i++ ) { |
5856 | $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); |
5857 | } |
5858 |
|
Line | Code |
5892 |
|
5893 | /** |
5894 | * Filters the retrieved list of pages. |
5895 | * |
5896 | * @since 2.1.0 |
5897 | * |
5898 | * @param WP_Post[] $pages Array of page objects. |
5899 | * @param array $parsed_args Array of get_pages() arguments. |
5900 | */ |
5901 | return apply_filters( 'get_pages', $pages, $parsed_args ); |
5902 | } |
5903 |
|
5904 | // |
5905 | // Attachment functions. |
5906 | // |
5907 |
|
5908 | /** |
5909 | * Determines whether an attachment URI is local and really an attachment. |
5910 | * |