WP::add_query_var() WordPress Method

The WP::add_query_var() function allows you to add a new query variable to WordPress. This function takes two arguments: the name of the variable, and an optional value. The value is optional because WordPress will automatically generate a value for the variable if one is not provided.

WP::add_query_var( string $qv ) #

Adds a query variable to the list of public query variables.


Parameters

$qv

(string)(Required)Query variable name.


Top ↑

Source

File: wp-includes/class-wp.php

	public function add_query_var( $qv ) {
		if ( ! in_array( $qv, $this->public_query_vars, true ) ) {
			$this->public_query_vars[] = $qv;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.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.