Make WordPress Core

Changeset 27166


Ignore:
Timestamp:
02/12/2014 04:48:14 AM (10 years ago)
Author:
wonderboymusic
Message:

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.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-thumbnail-template.php

    r26868 r27166  
    5858        $wp_query = $GLOBALS['wp_query'];
    5959
    60     if ( $wp_query->thumbnails_cached )
     60    if ( $wp_query->thumbnails_cached || ! $wp_query->posts )
    6161        return;
    6262
     
    7070        _prime_post_caches( $thumb_ids, false, true );
    7171    }
    72 
     72   
    7373    $wp_query->thumbnails_cached = true;
    7474}
Note: See TracChangeset for help on using the changeset viewer.