WordPress.org

Make WordPress Core

Changeset 22278


Ignore:
Timestamp:
10/23/12 14:18:37 (18 months ago)
Author:
nacin
Message:

Prime post caches for the Recent Comments widget. props mitchoyoshitaka. see #15400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-widgets.php

    r22118 r22278  
    687687        $output .= '<ul id="recentcomments">'; 
    688688        if ( $comments ) { 
     689            // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) 
     690            $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); 
     691            _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); 
     692 
    689693            foreach ( (array) $comments as $comment) { 
    690694                $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>'; 
Note: See TracChangeset for help on using the changeset viewer.