diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index e3cfdef312..943113605c 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1434,6 +1434,24 @@ function comments_template( $file = '/comments.php', $separate_comments = false $top_level_args['include_unapproved'] = $comment_args['include_unapproved']; } + /** + * Filters the arguments used in the top level comments query. + * + * @since 5.6.0 + * + * @see WP_Comment_Query::__construct() + * + * @param array $top_level_args { + * The top level query arguments for the comments template. + * + * @type bool $count Whether to return a comment count. + * @type string|array $orderby The field(s) to order by. + * @type int $post_id The post ID. + * @type string|array $status The comment status to limit results by. + * } + */ + $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args ); + $top_level_count = $top_level_query->query( $top_level_args ); $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page; @@ -1463,7 +1481,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false * @type int $number Number of comments to fetch. * } */ - $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); + $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); + $comment_query = new WP_Comment_Query( $comment_args ); $_comments = $comment_query->comments; diff --git a/wp-includes/version.php b/wp-includes/version.php index 984cdc9922..0d26f052ad 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49255'; +$wp_version = '5.6-alpha-49256'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.