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
3056      function set_found_posts( $q, $limits ) {
3057           global $wpdb;
3058
3059           // Bail if posts is an empty array. Continue if posts is an empty string,
3060           // null, or false to accommodate caching plugins that fill posts later.
3061           if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3062                return;
3063
3064           if ( ! empty( $limits ) )
3065                $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
3066           else
3067                $this->found_posts = count( $this->posts );
3068
3069           $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3070
3071           if ( ! empty( $limits ) )
3072                $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3073      }
3074