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 |
|---|---|
| 2478 | $r = wp_parse_args( $args, $defaults ); |
| 2479 | extract( $r, EXTR_SKIP ); |
| 2480 | $number = (int) $number; |
| 2481 | $offset = (int) $offset; |
| 2482 | |
| 2483 | $cache = array(); |
| 2484 | $key = md5( serialize( compact(array_keys($defaults)) ) ); |
| 2485 | if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { |
| 2486 | if ( is_array($cache) && isset( $cache[ $key ] ) ) { |
| 2487 | $pages = apply_filters('get_pages', $cache[ $key ], $r ); |
| 2488 | return $pages; |
| 2489 | } |
| 2490 | } |
| 2491 | |
| 2492 | if ( !is_array($cache) ) |
| 2493 | $cache = array(); |
| 2494 | |
| 2495 | $inclusions = ''; |
| 2496 | if ( !empty($include) ) { |
| Line | Code |
| 2576 | $query .= $author_query; |
| 2577 | $query .= " ORDER BY " . $sort_column . " " . $sort_order ; |
| 2578 | |
| 2579 | if ( !empty($number) ) |
| 2580 | $query .= ' LIMIT ' . $offset . ',' . $number; |
| 2581 | |
| 2582 | $pages = $wpdb->get_results($query); |
| 2583 | |
| 2584 | if ( empty($pages) ) { |
| 2585 | $pages = apply_filters('get_pages', array(), $r); |
| 2586 | return $pages; |
| 2587 | } |
| 2588 | |
| 2589 | // Sanitize before caching so it'll only get done once |
| 2590 | $num_pages = count($pages); |
| 2591 | for ($i = 0; $i < $num_pages; $i++) { |
| 2592 | $pages[$i] = sanitize_post($pages[$i], 'raw'); |
| 2593 | } |
| 2594 | |
| Line | Code |
| 2609 | for ( $i = 0; $i < $num_pages; $i++ ) { |
| 2610 | if ( in_array($pages[$i]->ID, $excludes) ) |
| 2611 | unset($pages[$i]); |
| 2612 | } |
| 2613 | } |
| 2614 | |
| 2615 | $cache[ $key ] = $pages; |
| 2616 | wp_cache_set( 'get_pages', $cache, 'posts' ); |
| 2617 | |
| 2618 | $pages = apply_filters('get_pages', $pages, $r); |
| 2619 | |
| 2620 | return $pages; |
| 2621 | } |
| 2622 | |
| 2623 | // |
| 2624 | // Attachment functions |
| 2625 | // |
| 2626 | |
| 2627 | /** |