W3cubDocs

/WordPress

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

Constructor.

Description

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

See also

Parameters

$querystring|arrayoptional
URL query string or array of vars.

Default:''

Source

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

Changelog

Version Description
1.5.0 Introduced.

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