Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.