apply_filters( 'comments_template_query_args', array $comment_args )
- Since
- 4.5.0
Filters the arguments used to query comments in comments_template().
Compatibility
- WordPress
- since 4.5.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
$comment_argsarray- { Array of WP_Comment_Query arguments.
@type string|array $orderby Field(s) to order by.
@type string $order Order of results. Accepts 'ASC' or 'DESC'.
@type string $status Comment status.
@type array $include_unapproved Array of IDs or email addresses whose unapproved comments will be included in results.
@type int $post_id ID of the post.
@type bool $no_found_rows Whether to refrain from querying for found rows.
@type bool $update_comment_meta_cache Whether to prime cache for comment meta.
@type bool|string $hierarchical Whether to query for comments hierarchically.
@type int $offset Comment offset.
@type int $number Number of comments to fetch.
}$orderbystring|arrayField(s) to order by.$orderstringOrder of results. Accepts 'ASC' or 'DESC'.$statusstringComment status.$include_unapprovedarrayArray of IDs or email addresses whose unapproved comments will be included in results.$post_idintID of the post.$no_found_rowsboolWhether to refrain from querying for found rows.$update_comment_meta_cacheboolWhether to prime cache for comment meta.$hierarchicalbool|stringWhether to query for comments hierarchically.$offsetintComment offset.$numberintNumber of comments to fetch.
Where this hook fires · 1
wp-includes/comment-template.php:1555comments_template()
Source code
* @type bool $update_comment_meta_cache Whether to prime cache for comment meta. * @type bool|string $hierarchical Whether to query for comments hierarchically. * @type int $offset Comment offset. * @type int $number Number of comments to fetch. * } */ $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); $comment_query = new WP_Comment_Query( $comment_args ); $_comments = $comment_query->comments; // Trees must be flattened before they're passed to the walker. if ( $comment_args['hierarchical'] ) {Changelog
Introduced in 4.5.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.