WP_Comment_Query::query()publicWP 3.1.0

Sets up the WordPress query for retrieving comments.

Method of the class: WP_Comment_Query{}

No Hooks.

Return

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

Usage

$WP_Comment_Query = new WP_Comment_Query();
$WP_Comment_Query->query( $query );
$query(string|array) (required)
Array or URL query string of parameters.

Changelog

Since 3.1.0 Introduced.
Since 4.1.0 Introduced '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.
Since 4.2.0 Moved parsing to WP_Comment_Query::parse_query().

WP_Comment_Query::query() code WP 6.4.3

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