get_query_var

Advertisement

Summery Summery

Retrieve variable in the WP_Query class.

Syntax Syntax

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

Parameters Parameters

$var

(string) (Required) The variable key to retrieve.

$default

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

Default value: ''

Return Return

(mixed) Contents of the query variable.

Source Source

File: wp-includes/query.php

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

Advertisement

Changelog Changelog

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

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.