WP::set_query_var()publicWP 2.3.0

Sets the value of a query variable.

{} It's a method of the class: WP{}

No Hooks.

Return

null. Nothing.

Usage

global $wp;
$wp->set_query_var( $key, $value );
$key(string) (required)
Query variable name.
$value(mixed) (required)
Query variable value.

Changelog

Since 2.3.0 Introduced.

Code of WP::set_query_var() WP 6.0

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