Make WordPress Core

Changeset 55513

Timestamp:
03/10/2023 03:24:01 PM (17 months ago)
Author:
spacedmonkey
Message:

Comments: Prime post caches in WP_Comments_List_Table.

In the WP_Comments_List_Table class, when the function get_comments is called, pass the parameter update_comment_post_cache set to true. This primes all the related posts for the displayed comments. This improves performance, as all posts are primed at once.

Props spacedmonkey, adarshposimyth.
Fixes #57802.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r55276 r55513  
    141141
    142142        $args = array(
    143             'status'    => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status,
    144             'search'    => $search,
    145             'user_id'   => $user_id,
    146             'offset'    => $start,
    147             'number'    => $number,
    148             'post_id'   => $post_id,
    149             'type'      => $comment_type,
    150             'orderby'   => $orderby,
    151             'order'     => $order,
    152             'post_type' => $post_type,
     143            'status'                    => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status,
     144            'search'                    => $search,
     145            'user_id'                   => $user_id,
     146            'offset'                    => $start,
     147            'number'                    => $number,
     148            'post_id'                   => $post_id,
     149            'type'                      => $comment_type,
     150            'orderby'                   => $orderby,
     151            'order'                     => $order,
     152            'post_type'                 => $post_type,
     153            'update_comment_post_cache' => true,
    153154        );
    154155
Note: See TracChangeset for help on using the changeset viewer.