WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Codex doesn't really explain it very well, what is it used for and how do I use it exactly?

share|improve this question
up vote 1 down vote accepted

It is explained pretty thoroughly in the Codex, in my opinion. It serves a purpose e.g. when you want to grab posts for your taxonomy, it is a URL slug for your taxonomy, e.g. example.com/tag/cats -> example.com/query_var/cats.

Note: The query_var is used for direct queries through WP_Query like

new WP_Query( array( 'people' => $person_name ) )

and URL queries like /?people=$person_name. Setting query_var to false will disable these methods, but you can still fetch posts with an explicit WP_Query taxonomy query like

WP_Query(array('taxonomy'=>'people', 'term'=>$person_name)).

Basically, query_var is part of the WordPress Query Vars.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.