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 |
---|---|
4642 | // $args can be whatever, only use the args defined in defaults to compute the key. |
4643 | $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) ); |
4644 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
4645 |
|
4646 | $cache_key = "get_pages:$key:$last_changed"; |
4647 | if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) { |
4648 | // Convert to WP_Post instances. |
4649 | $pages = array_map( 'get_post', $cache ); |
4650 | /** This filter is documented in wp-includes/post.php */ |
4651 | $pages = apply_filters( 'get_pages', $pages, $r ); |
4652 | return $pages; |
4653 | } |
4654 |
|
4655 | $inclusions = ''; |
4656 | if ( ! empty( $r['include'] ) ) { |
4657 | $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include |
4658 | $parent = -1; |
4659 | $exclude = ''; |
4660 | $meta_key = ''; |
Line | Code |
4784 |
|
4785 | if ( ! empty( $number ) ) { |
4786 | $query .= ' LIMIT ' . $offset . ',' . $number; |
4787 | } |
4788 |
|
4789 | $pages = $wpdb->get_results($query); |
4790 |
|
4791 | if ( empty($pages) ) { |
4792 | /** This filter is documented in wp-includes/post.php */ |
4793 | $pages = apply_filters( 'get_pages', array(), $r ); |
4794 | return $pages; |
4795 | } |
4796 |
|
4797 | // Sanitize before caching so it'll only get done once. |
4798 | $num_pages = count($pages); |
4799 | for ($i = 0; $i < $num_pages; $i++) { |
4800 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
4801 | } |
4802 |
|
Line | Code |
4836 |
|
4837 | /** |
4838 | * Filters the retrieved list of pages. |
4839 | * |
4840 | * @since 2.1.0 |
4841 | * |
4842 | * @param array $pages List of pages to retrieve. |
4843 | * @param array $r Array of get_pages() arguments. |
4844 | */ |
4845 | return apply_filters( 'get_pages', $pages, $r ); |
4846 | } |
4847 |
|
4848 | // |
4849 | // Attachment functions |
4850 | // |
4851 |
|
4852 | /** |
4853 | * Check if the attachment URI is local one and is really an attachment. |
4854 | * |