Revert [27166].

We should not be accounting for improper assignment of WP_Query properties.

fixes #26321.


git-svn-id: https://develop.svn.wordpress.org/trunk@27746 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-03-26 18:42:41 +00:00
parent 79ff680b93
commit 36496a3877
2 changed files with 2 additions and 32 deletions

View File

@ -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 || ! $wp_query->posts )
if ( $wp_query->thumbnails_cached )
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;
}

View File

@ -1,30 +0,0 @@
<?php
/**
* @group post
* @group thumbnails
*/
class Tests_Post_Thumbnails extends WP_UnitTestCase {
/**
* @ticket 26321
*/
function test_update_post_thumbnail_cache() {
update_post_thumbnail_cache();
$this->assertFalse( $GLOBALS['wp_query']->thumbnails_cached );
$this->factory->post->create_many( 3 );
$GLOBALS['wp_query'] = new WP_Query( array( 'post_type' => 'post' ) );
update_post_thumbnail_cache();
$this->assertTrue( $GLOBALS['wp_query']->thumbnails_cached );
$q = new WP_Query();
update_post_thumbnail_cache( $q );
$this->assertFalse( $q->thumbnails_cached );
$p = new WP_Query( array( 'post_type' => 'post' ) );
update_post_thumbnail_cache( $p );
$this->assertTrue( $p->thumbnails_cached );
}
}