WP_Query::set()publicWP 1.5.0

Sets the value of a query variable.

Method of the class: WP_Query{}

No Hooks.

Return

null. Nothing (null).

Usage

global $wp_query;
$wp_query->set( $query_var, $value );
$query_var(string) (required)
Query variable key.
$value(mixed) (required)
Query variable value.

Changelog

Since 1.5.0 Introduced.

WP_Query::set() code WP 6.4.3

public function set( $query_var, $value ) {
	$this->query_vars[ $query_var ] = $value;
}