get_query_var( string $var, mixed $default = '' )

Retrieve variable in the WP_Query class.


Parameters

$var

(Required) The variable key to retrieve.

$default

(Optional) Value to return if the query variable is not set.

Default value: ''


Return

(mixed) Contents of the query variable.


Source

File: wp-includes/query.php

function get_query_var( $var, $default = '' ) {
	global $wp_query;
	return $wp_query->get( $var, $default );
}


Changelog

Changelog
Version Description
WP-3.9.0 The $default argument was introduced.
WP-1.5.0 Introduced.