WP_Query::__construct( string|array $query = '' )

Constructor.

Description

Sets up the WordPress query, if parameter is not empty.

See also

Parameters

$query

(string|array) (Optional) URL query string or array of vars.

Default value: ''

Source

File: wp-includes/class-wp-query.php

public function __construct( $query = '' ) {
		if ( ! empty( $query ) ) {
			$this->query( $query );
		}
	}

Changelog

Version Description
1.5.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/__construct