WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/05/2015 10:24:16 PM (6 years ago)
Author:
wonderboymusic
Message:

In wp_list_comments(), update the comment meta cache when the comments derive from WP_Query and the new ->comment_meta_cached prop is false.

There are no uses of wp_list_comments() in Core where $comments are passed as the 2nd argument.

Adds unit tests.

Props wonderboymusic, bradt.
Fixes #16894.

File:
1 edited

Legend:

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

    r33919 r33925  
    21162116        } else {
    21172117            $_comments = $wp_query->comments;
     2118        }
     2119
     2120        if ( ! $wp_query->comment_meta_cached ) {
     2121            $comment_ids = wp_list_pluck( $_comments, 'comment_ID' );
     2122            update_meta_cache( 'comment', $comment_ids );
     2123            $wp_query->comment_meta_cached = true;
    21182124        }
    21192125    }
Note: See TracChangeset for help on using the changeset viewer.