Lazy-load comment meta on single post pages.

[34268] introduced cache priming for commentmeta, enabled by default. To
ensure performance on single post pages - where commentmeta is most likely
to cause performance issues - we disable up-front cache-priming. Instead, we
prime commentmeta caches for all comments in the loop the first time
`get_comment_meta()` is called on the page.

Props bradt, dd32, wonderboymusic, boonebgorges.
Fixes #16894.

git-svn-id: https://develop.svn.wordpress.org/trunk@34270 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-09-17 20:00:31 +00:00
parent 5ea07785b3
commit 504deb52fc
4 changed files with 49 additions and 46 deletions

View File

@@ -1211,6 +1211,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false
'orderby' => 'comment_date_gmt',
'status' => 'approve',
'post_id' => $post->ID,
'update_comment_meta_cache' => false, // We lazy-load comment meta for performance.
);
if ( $user_ID ) {