WP_Comment_Query::query( string|array $query ): array|int

In this article

Sets up the WordPress query for retrieving comments.

Parameters

$querystring|arrayrequired
Array or URL query string of parameters.

Return

array|int List of comments, or number of comments when 'count' is passed as a query var.

Source

public function query( $query ) {
	$this->query_vars = wp_parse_args( $query );
	return $this->get_comments();
}

Changelog

VersionDescription
4.2.0Moved parsing to WP_Comment_Query::parse_query().
4.1.0Introduced 'comment__in', 'comment__not_in', 'post_author__in', 'post_author__not_in', 'author__in', 'author__not_in', 'post__in', 'post__not_in', 'include_unapproved', 'type__in', and 'type__not_in' arguments to $query_vars.
3.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.