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