mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Don't iterate over $wp_query->posts in update_post_thumbnail_cache() if it is empty. Adds unit tests.
Props SergeyBiryukov, for the original patch. Fixes #26321. git-svn-id: https://develop.svn.wordpress.org/trunk@27166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -57,7 +57,7 @@ function update_post_thumbnail_cache( $wp_query = null ) {
|
||||
if ( ! $wp_query )
|
||||
$wp_query = $GLOBALS['wp_query'];
|
||||
|
||||
if ( $wp_query->thumbnails_cached )
|
||||
if ( $wp_query->thumbnails_cached || ! $wp_query->posts )
|
||||
return;
|
||||
|
||||
$thumb_ids = array();
|
||||
@@ -69,7 +69,7 @@ function update_post_thumbnail_cache( $wp_query = null ) {
|
||||
if ( ! empty ( $thumb_ids ) ) {
|
||||
_prime_post_caches( $thumb_ids, false, true );
|
||||
}
|
||||
|
||||
|
||||
$wp_query->thumbnails_cached = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user