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 |
|---|---|
| 4566 | // $args can be whatever, only use the args defined in defaults to compute the key. |
| 4567 | $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) ); |
| 4568 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
| 4569 | |
| 4570 | $cache_key = "get_pages:$key:$last_changed"; |
| 4571 | if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) { |
| 4572 | // Convert to WP_Post instances. |
| 4573 | $pages = array_map( 'get_post', $cache ); |
| 4574 | /** This filter is documented in wp-includes/post.php */ |
| 4575 | $pages = apply_filters( 'get_pages', $pages, $r ); |
| 4576 | return $pages; |
| 4577 | } |
| 4578 | |
| 4579 | $inclusions = ''; |
| 4580 | if ( ! empty( $r['include'] ) ) { |
| 4581 | $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include |
| 4582 | $parent = -1; |
| 4583 | $exclude = ''; |
| 4584 | $meta_key = ''; |
| Line | Code |
| 4708 | |
| 4709 | if ( ! empty( $number ) ) { |
| 4710 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 4711 | } |
| 4712 | |
| 4713 | $pages = $wpdb->get_results($query); |
| 4714 | |
| 4715 | if ( empty($pages) ) { |
| 4716 | /** This filter is documented in wp-includes/post.php */ |
| 4717 | $pages = apply_filters( 'get_pages', array(), $r ); |
| 4718 | return $pages; |
| 4719 | } |
| 4720 | |
| 4721 | // Sanitize before caching so it'll only get done once. |
| 4722 | $num_pages = count($pages); |
| 4723 | for ($i = 0; $i < $num_pages; $i++) { |
| 4724 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 4725 | } |
| 4726 | |
| Line | Code |
| 4760 | |
| 4761 | /** |
| 4762 | * Filters the retrieved list of pages. |
| 4763 | * |
| 4764 | * @since 2.1.0 |
| 4765 | * |
| 4766 | * @param array $pages List of pages to retrieve. |
| 4767 | * @param array $r Array of get_pages() arguments. |
| 4768 | */ |
| 4769 | return apply_filters( 'get_pages', $pages, $r ); |
| 4770 | } |
| 4771 | |
| 4772 | // |
| 4773 | // Attachment functions |
| 4774 | // |
| 4775 | |
| 4776 | /** |
| 4777 | * Check if the attachment URI is local one and is really an attachment. |
| 4778 | * |