WP_Comment_Query::query( string|array $query ): WP_Comment[]|int[]|int
- Since
- 3.1.0, 4.1.0, 4.2.0
- Source
wp-includes/class-wp-comment-query.php:370
Sets up the WordPress query for retrieving comments.
Parameters
$querystring|array- Array or URL query string of parameters.
Return
WP_Comment[]|int[]|int- List of comments, or number of comments when 'count' is passed as a query var.
Uses · 2
- wp_parse_args()Merges user defined arguments into defaults array.
- WP_Comment_Query::get_comments()Get a list of comments matching the query vars.
Used by · 1
- WP_Comment_Query::__construct()Constructor.
Source
public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_comments(); }History
Introduced in 4.1.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.1.0
Return type changed from
array|int to WP_Comment[]|int[]|int.verified against source4.2.0
Moved parsing to WP_Comment_Query::parse_query().from the docblock
4.1.0
Introduced 'comment<strong>in', 'comment</strong>not_in', 'post_author<strong>in', 'post_author__not_in', 'author</strong>in', 'author__not_in', 'post<strong>in', 'post</strong>not_in', 'include_unapproved', 'type<strong>in', and 'type</strong>not_in' arguments to $query_vars.from the docblock
3.1.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-comment-query.php, 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.