Make WordPress Core

Ticket #50521: 50521.diff

File 50521.diff, 1.0 KB (added by imath, 4 years ago)
  • src/wp-includes/class-wp-comment-query.php

    diff --git src/wp-includes/class-wp-comment-query.php src/wp-includes/class-wp-comment-query.php
    index bbc6fe2d66..ecd3e5fe7c 100644
    class WP_Comment_Query { 
    390390                 * When `$this->query_vars['count']` is set, the filter should return the comment count as an int.
    391391                 * When `'ids' === $this->query_vars['fields']`, the filter should return an array of comment IDs.
    392392                 * Otherwise the filter should return an array of WP_Comment objects.
     393                 * Note that if the filter return an array, that array will be assigned to the comments property of
     394                 * the current WP_Comment_Query instance.
    393395                 *
    394396                 * @since 5.3.0
    395397                 *
    class WP_Comment_Query { 
    401403                $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );
    402404
    403405                if ( null !== $comment_data ) {
     406                        if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) {
     407                                $this->comments = $comment_data;
     408                        }
    404409                        return $comment_data;
    405410                }
    406411