WordPress.org

Make WordPress Core

Ticket #19726: 19726.diff

File 19726.diff, 682 bytes (added by prettyboymp, 6 years ago)
  • wp-includes/post-thumbnail-template.php

     
    5959
    6060        $thumb_ids = array();
    6161        foreach ( $wp_query->posts as $post ) {
    62                 if ( $id = get_post_thumbnail_id( $post->ID ) )
     62                if ( ( $id = get_post_thumbnail_id( $post->ID ) ) && ! wp_cache_get( $id, 'posts' ) )
    6363                        $thumb_ids[] = $id;
    6464        }
    6565
    6666        if ( ! empty ( $thumb_ids ) ) {
    6767                get_posts( array(
     68                                'cache_results' => true,
    6869                                'update_post_term_cache' => false,
    6970                                'include' => $thumb_ids,
    7071                                'post_type' => 'attachment',