WordPress at a glance
function is not described

WP_Query::query() WP 1.5.0

Sets up the WordPress query by parsing query string.

This is a method of the class: WP_Query

No Hooks.


WP_Post[]/Int[]. Array of post objects or post IDs.


$WP_Query = new WP_Query();
$var = $WP_Query->query( $query );
$query(string/array) (required)
URL query string or array of query arguments.


Since 1.5.0 Introduced.

Code of WP Query::query: wp-includes/class-wp-query.php WP 5.4.2

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