- File:
-
- 1 edited
-
trunk/wp-includes/post-thumbnail-template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-thumbnail-template.php
r17883 r15990 49 49 50 50 /** 51 * Update cache for thumbnails in the current loop52 *53 * @sicne 3.254 */55 function update_post_thumbnail_cache() {56 global $wp_query;57 58 if ( $wp_query->thumbnails_cached )59 return;60 61 $thumb_ids = array();62 foreach ( $wp_query->posts as $post ) {63 if ( $id = get_post_thumbnail_id( $post->ID ) )64 $thumb_ids[] = $id;65 }66 67 if ( ! empty ( $thumb_ids ) ) {68 get_posts( array(69 'update_post_term_cache' => false,70 'include' => $thumb_ids,71 'post_type' => 'attachment',72 'post_status' => 'inherit',73 'nopaging' => true74 ) );75 }76 77 $wp_query->thumbnails_cached = true;78 }79 80 /**81 51 * Retrieve Post Thumbnail. 82 52 * … … 93 63 if ( $post_thumbnail_id ) { 94 64 do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters 95 if ( in_the_loop() )96 update_post_thumbnail_cache();97 65 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); 98 66 do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
Note: See TracChangeset
for help on using the changeset viewer.