diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index a04f9bef89..b8d2e43357 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -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); diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index a58bbfe20b..039d529939 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -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;