If posts is an empty array, bail from set_found_posts(). If posts is null or otherwise empty proceed through set_found_posts(). This accommodates caching plugins such as Advanced Post Cache that force posts to be empty for later population but still require the found_posts_query filter to run.

fixes #14426


git-svn-id: http://core.svn.wordpress.org/trunk@22258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-10-17 20:57:23 +00:00
parent f742b675be
commit 9e39bc5897

View File

@ -2799,7 +2799,9 @@ class WP_Query {
function set_found_posts( $q, $limits ) {
global $wpdb;
if ( $q['no_found_rows'] || ! $this->posts )
// Bail if posts is an empty array. Continue if posts is an empty string
// null, or false to accommodate caching plugins that fill posts later.
if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
return;
if ( ! empty( $limits ) )