Make WordPress Core

Ticket #35075: 35075.2.patch

File 35075.2.patch, 1.1 KB (added by jason_the_adams, 9 years ago)

Includes inline docs for filter

  • src/wp-includes/class-wp-comment-query.php

    diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
    index e30094d..1846fb2 100644
    a b class WP_Comment_Query { 
    362362                        $this->meta_query_clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this );
    363363                }
    364364
    365                 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
    366                 $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
     365                /**
     366                 * Filter the keys used to determine the comment cache.
     367                 *
     368                 * @since 4.5.0
     369                 *
     370                 * @param array           $cache_keys   keys that will be used in the query_vars to cache the comment
     371                 */
     372    $cache_keys = apply_filters('comment_cache_keys', array_keys( $this->query_vars ) );
     373                $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, $cache_keys ) ) );
    367374                $last_changed = wp_cache_get( 'last_changed', 'comment' );
    368375                if ( ! $last_changed ) {
    369376                        $last_changed = microtime();