Make WordPress Core


Ignore:
Timestamp:
09/30/2015 01:34:54 AM (9 years ago)
Author:
boonebgorges
Message:

Improve lazyloading of comment meta in WP_Query loops.

Lazy-loading logic is moved to a method on WP_Query. This makes it possible
for comment feeds to take advantage of metadata lazyloading, in addition to
comments loaded via comments_template().

This new technique parallels the termmeta lazyloading technique introduced in
[34704].

Fixes #34047.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r34669 r34711  
    13211321     */
    13221322    $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
     1323
     1324    // Set up lazy-loading for comment metadata.
     1325    add_action( 'get_comment_metadata', array( $wp_query, 'lazyload_comment_meta' ), 10, 2 );
     1326
    13231327    $comments = &$wp_query->comments;
    13241328    $wp_query->comment_count = count($wp_query->comments);
Note: See TracChangeset for help on using the changeset viewer.