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
2817      function set_found_posts( $q, $limits ) {
2818           global $wpdb;
2819
2820           // Bail if posts is an empty array. Continue if posts is an empty string,
2821           // null, or false to accommodate caching plugins that fill posts later.
2822           if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
2823                return;
2824
2825           if ( ! empty( $limits ) )
2826                $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
2827           else
2828                $this->found_posts = count( $this->posts );
2829
2830           $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
2831
2832           if ( ! empty( $limits ) )
2833                $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
2834      }
2835