Query: After [37692], don't skip set_found_posts() when no posts are found.

The 'found_posts' filter must continue to run for plugins manipulating post
results via filter.

Props dd32.
Fixes #36687.

git-svn-id: https://develop.svn.wordpress.org/trunk@37712 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2016-06-15 12:32:25 +00:00
parent 3c34040bf2
commit ade41fc2cf
2 changed files with 38 additions and 2 deletions

View File

@@ -3650,10 +3650,11 @@ class WP_Query {
}
}
// Convert to WP_Post objects and set the found-post totals.
$this->set_found_posts( $q, $limits );
// Convert to WP_Post objects.
if ( $this->posts ) {
$this->posts = array_map( 'get_post', $this->posts );
$this->set_found_posts( $q, $limits );
}
if ( ! $q['suppress_filters'] ) {