Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: found_posts_query

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2800      function set_found_posts( $q, $limits ) {
2801           global $wpdb;
2802
2803           // Bail if posts is an empty array. Continue if posts is an empty string
2804           // null, or false to accommodate caching plugins that fill posts later.
2805           if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
2806                return;
2807
2808           if ( ! empty( $limits ) )
2809                $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
2810           else
2811                $this->found_posts = count( $this->posts );
2812
2813           $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
2814
2815           if ( ! empty( $limits ) )
2816                $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
2817      }
2818