WordPress at Your Fingertips
function is not described

WP_Query::get() public WP 1.5.0

Retrieves the value of a query variable.

{} It's a method of the class: WP_Query{}

No Hooks.


Mixed. Contents of the query variable.


global $wp_query;
$wp_query->get( $query_var, $default );
$query_var(string) (required)
Query variable key.
Value to return if the query variable is not set.
Default: empty string


Since 1.5.0 Introduced.
Since 3.9.0 The $default argument was introduced.

Code of WP_Query::get() WP 5.8

public function get( $query_var, $default = '' ) {
	if ( isset( $this->query_vars[ $query_var ] ) ) {
		return $this->query_vars[ $query_var ];

	return $default;