Home > AI > Backend > Wordpress >

get_query_var

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

Retrieves the value of a query variable in the WP_Query class.

Examples:

// current taxonomy
$term_name = get_query_var('taxonomy'); 

// current cat slug
$cat_slug = get_query_var( 'term' ); 

Leave a Reply