WP::set_query_var() WordPress Method

The set_query_var() function sets the value of a query variable. This function can be used to set the value of a query variable for the current query. It can also be used to set the value of a query variable for a given WP_Query object.

WP::set_query_var( string $key, mixed $value ) #

Sets the value of a query variable.


Parameters

$key

(string)(Required)Query variable name.

$value

(mixed)(Required)Query variable value.


Top ↑

Source

File: wp-includes/class-wp.php

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

Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.