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 |
|---|---|
| 4808 | // $args can be whatever, only use the args defined in defaults to compute the key. |
| 4809 | $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) ); |
| 4810 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
| 4811 | |
| 4812 | $cache_key = "get_pages:$key:$last_changed"; |
| 4813 | if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) { |
| 4814 | // Convert to WP_Post instances. |
| 4815 | $pages = array_map( 'get_post', $cache ); |
| 4816 | /** This filter is documented in wp-includes/post.php */ |
| 4817 | $pages = apply_filters( 'get_pages', $pages, $r ); |
| 4818 | return $pages; |
| 4819 | } |
| 4820 | |
| 4821 | $inclusions = ''; |
| 4822 | if ( ! empty( $r['include'] ) ) { |
| 4823 | $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include |
| 4824 | $parent = -1; |
| 4825 | $exclude = ''; |
| 4826 | $meta_key = ''; |
| Line | Code |
| 4950 | |
| 4951 | if ( ! empty( $number ) ) { |
| 4952 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 4953 | } |
| 4954 | |
| 4955 | $pages = $wpdb->get_results($query); |
| 4956 | |
| 4957 | if ( empty($pages) ) { |
| 4958 | /** This filter is documented in wp-includes/post.php */ |
| 4959 | $pages = apply_filters( 'get_pages', array(), $r ); |
| 4960 | return $pages; |
| 4961 | } |
| 4962 | |
| 4963 | // Sanitize before caching so it'll only get done once. |
| 4964 | $num_pages = count($pages); |
| 4965 | for ($i = 0; $i < $num_pages; $i++) { |
| 4966 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 4967 | } |
| 4968 | |
| Line | Code |
| 5002 | |
| 5003 | /** |
| 5004 | * Filters the retrieved list of pages. |
| 5005 | * |
| 5006 | * @since 2.1.0 |
| 5007 | * |
| 5008 | * @param array $pages List of pages to retrieve. |
| 5009 | * @param array $r Array of get_pages() arguments. |
| 5010 | */ |
| 5011 | return apply_filters( 'get_pages', $pages, $r ); |
| 5012 | } |
| 5013 | |
| 5014 | // |
| 5015 | // Attachment functions |
| 5016 | // |
| 5017 | |
| 5018 | /** |
| 5019 | * Determines whether an attachment URI is local and really an attachment. |
| 5020 | * |