Make WordPress Core


Ignore:
Timestamp:
09/17/2015 07:29:46 PM (9 years ago)
Author:
boonebgorges
Message:

Prime comment meta caches in WP_Comment_Query.

The new 'update_comment_meta_cache' parameter, which defaults to true, can
be used to disable this behavior.

update_comment_cache() has been updated to support an $update_meta_cache
parameter, which also updates to true; this matches the pattern we use for
priming post caches.

See #16894.

File:
1 edited

Legend:

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

    r34212 r34268  
    9595     * @since 4.2.0
    9696     * @since 4.4.0 `$parent__in` and `$parent__not_in` were added.
    97      * @since 4.4.0 Order by `comment__in` was added.
     97     * @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache` was added.
    9898     * @access public
    9999     *
     
    162162     *     @type array        $type__not_in        Exclude comments from a given array of comment types. Default empty.
    163163     *     @type int          $user_id             Include comments for a specific user ID. Default empty.
     164     *     @type bool         $update_comment_meta_cache Whether to prime the metadata cache for found comments.
     165     *                                                   Default true.
    164166     * }
    165167     */
     
    202204            'meta_query' => '',
    203205            'date_query' => null, // See WP_Date_Query
     206            'update_comment_meta_cache' => true,
    204207        );
    205208
     
    699702        wp_cache_add( $cache_key, $comments, 'comment' );
    700703        if ( '*' === $fields ) {
    701             update_comment_cache( $comments );
     704            update_comment_cache( $comments, $this->query_vars['update_comment_meta_cache'] );
    702705        }
    703706
Note: See TracChangeset for help on using the changeset viewer.