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
3071      function set_found_posts( $q, $limits ) {
3072           global $wpdb;
3073
3074           // Bail if posts is an empty array. Continue if posts is an empty string,
3075           // null, or false to accommodate caching plugins that fill posts later.
3076           if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3077                return;
3078
3079           if ( ! empty( $limits ) )
3080                $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
3081           else
3082                $this->found_posts = count( $this->posts );
3083
3084           $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3085
3086           if ( ! empty( $limits ) )
3087                $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3088      }
3089