Make WordPress Core


Ignore:
Timestamp:
09/28/2015 03:09:46 PM (9 years ago)
Author:
boonebgorges
Message:

In get_page_of_comment(), use a true COUNT query.

This improves memory usage by not compiling a list of comment IDs.

See #34057.

File:
1 edited

Legend:

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

    r34660 r34661  
    880880        'post_id'    => $comment->comment_post_ID,
    881881        'fields'     => 'ids',
     882        'count'      => true,
    882883        'status'     => 'approve',
    883884        'date_query' => array(
     
    889890    );
    890891
    891     $older_comment_ids = get_comments( $comment_args );
    892     $older_comment_count = count( $older_comment_ids );
     892    $comment_query = new WP_Comment_Query();
     893    $older_comment_count = $comment_query->query( $comment_args );
    893894
    894895    // No older comments? Then it's page #1.
Note: See TracChangeset for help on using the changeset viewer.