get_query_var( string $query_var, mixed $default_value = '' )
Retrieves the value of a query variable in the WP_Query class.
Parameters
- $query_var
-
(Required) The variable key to retrieve.
- $default_value
-
(Optional) Value to return if the query variable is not set.<br>
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
Version | Description |
---|---|
3.9.0 | The $default_value argument was introduced. |
1.5.0 | Introduced. |