Query: set_found_posts() must run immediately after main query.

If not run immediately after, the `SELECT FOUND_ROWS()` query might refer to
a different query, such as the one used to populate the post cache for a split
query.

Introduced in [37692].

Fixes #36687.
Built from https://develop.svn.wordpress.org/trunk@37721


git-svn-id: http://core.svn.wordpress.org/trunk@37687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-06-16 02:01:29 +00:00
parent d50ac5598f
commit 8603aa402a
2 changed files with 3 additions and 3 deletions

View File

@ -3641,17 +3641,17 @@ class WP_Query {
if ( $ids ) {
$this->posts = $ids;
$this->set_found_posts( $q, $limits );
_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
} else {
$this->posts = array();
}
} else {
$this->posts = $wpdb->get_results( $this->request );
$this->set_found_posts( $q, $limits );
}
}
$this->set_found_posts( $q, $limits );
// Convert to WP_Post objects.
if ( $this->posts ) {
$this->posts = array_map( 'get_post', $this->posts );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-alpha-37720';
$wp_version = '4.6-alpha-37721';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.