Update comment caches in WP_Comment_Query, rather than comments template.

props dd32.
fixes #31081.

Built from https://develop.svn.wordpress.org/trunk@32769


git-svn-id: http://core.svn.wordpress.org/trunk@32740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2015-06-14 19:21:25 +00:00
parent e7f618d86e
commit 7080c8e24b
3 changed files with 4 additions and 2 deletions

View File

@ -1202,7 +1202,6 @@ function comments_template( $file = '/comments.php', $separate_comments = false
$wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
$comments = &$wp_query->comments;
$wp_query->comment_count = count($wp_query->comments);
update_comment_cache($wp_query->comments);
if ( $separate_comments ) {
$wp_query->comments_by_type = separate_comments($comments);

View File

@ -893,6 +893,9 @@ class WP_Comment_Query {
$comments = apply_filters_ref_array( 'the_comments', array( $results, &$this ) );
wp_cache_add( $cache_key, $comments, 'comment' );
if ( '*' === $fields ) {
update_comment_cache( $comments );
}
$this->comments = $comments;
return $this->comments;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32768';
$wp_version = '4.3-alpha-32769';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.