wppaste
WordPress

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|array

    Field(s) to order by.
  • $orderstring

    Order of results. Accepts 'ASC' or 'DESC'.
  • $statusstring

    Comment status.
  • $include_unapprovedarray

    Array of IDs or email addresses whose unapproved comments will be included in results.
  • $post_idint

    ID of the post.
  • $no_found_rowsbool

    Whether to refrain from querying for found rows.
  • $update_comment_meta_cachebool

    Whether to prime cache for comment meta.
  • $hierarchicalbool|string

    Whether to query for comments hierarchically.
  • $offsetint

    Comment offset.
  • $numberint

    Number of comments to fetch.

Where this hook fires · 1

  • wp-includes/comment-template.php:1559comments_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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 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.