Update comment caches in WP_Comment_Query, rather than comments template.
props dd32. fixes #31081. git-svn-id: https://develop.svn.wordpress.org/trunk@32769 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8b5b201fa1
commit
cda77232fe
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user