WordPress.org

Make WordPress Core

Ticket #15400: 15400.diff

File 15400.diff, 843 bytes (added by mitchoyoshitaka, 20 months ago)

Quick patch using _prime_post_caches

  • wp-includes/default-widgets.php

     
    675675 
    676676                $output .= '<ul id="recentcomments">'; 
    677677                if ( $comments ) { 
     678                        // prime cache for associated posts 
     679                        $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); 
     680                        _prime_post_caches( $post_ids, false, false ); 
     681                 
    678682                        foreach ( (array) $comments as $comment) { 
    679683                                $output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; 
    680684                        }