WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/20/2020 08:09:39 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Comments: Add a filter for top level comments query arguments in comments_template().

Props hellofromTonya, Howdy_McGee, garrett-eclipse, davidbaumwald, thomaslhotta.
Fixes #38074.

File:
1 edited

Legend:

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

    r49193 r49256  
    14351435            }
    14361436
     1437            /**
     1438             * Filters the arguments used in the top level comments query.
     1439             *
     1440             * @since 5.6.0
     1441             *
     1442             * @see WP_Comment_Query::__construct()
     1443             *
     1444             * @param array $top_level_args {
     1445             *     The top level query arguments for the comments template.
     1446             *
     1447             *     @type bool         $count   Whether to return a comment count.
     1448             *     @type string|array $orderby The field(s) to order by.
     1449             *     @type int          $post_id The post ID.
     1450             *     @type string|array $status  The comment status to limit results by.
     1451             * }
     1452             */
     1453            $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args );
     1454
    14371455            $top_level_count = $top_level_query->query( $top_level_args );
    14381456
     
    14641482     * }
    14651483     */
    1466     $comment_args  = apply_filters( 'comments_template_query_args', $comment_args );
     1484    $comment_args = apply_filters( 'comments_template_query_args', $comment_args );
     1485
    14671486    $comment_query = new WP_Comment_Query( $comment_args );
    14681487    $_comments     = $comment_query->comments;
Note: See TracChangeset for help on using the changeset viewer.