apply_filters( 'comments_template_top_level_query_args', array $top_level_args )
- Since
- 5.6.0
Filters the arguments used in the top level comments query.
Compatibility
- WordPress
- since 5.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$top_level_argsarray- { 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.
}$countboolWhether to return a comment count.$orderbystring|arrayThe field(s) to order by.$post_idintThe post ID.$statusstring|arrayThe comment status to limit results by.
Where this hook fires · 1
wp-includes/comment-template.php:1524comments_template()
Source code
* @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'] = ( (int) ceil( $top_level_count / $per_page ) - 1 ) * $per_page; } }Changelog
Introduced in 5.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.