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

I have seen many different parameters or arguments that can be passed to a query. For example, category_in, category_and term_id to name a few. Some of these can be found by using print_r to print out the object. ( If I have that right ). Others like the category__in I have been unable to find in codex. Is there a trick to learning about these parameters? How do I find them?

share|improve this question
up vote 2 down vote accepted

They're all in the codex page for WP_Query.

share|improve this answer
Thanks Milo. It's funny that doing a direct search in the codex for category__in does not bring up that information – Jamie Oct 16 '12 at 0:45

As a compliment to Milo's answer and WP_Query Codex entry above, here is a nice little cheat-sheet and reference which summarizes the $arguments used with WP_Query;

WordPress Query Comprehensive Reference
Compiled by luetkemj - luetkemj.com

...and here's a little gist to go along with it for debugging your query,

Debugging WP_Query
from wpsmith

add_action( 'template_redirect', 'wps_debug' );
function wps_debug() {
    global $wp_query;
    if( isset( $_GET['debug'] ) ) {
        echo '<pre>'; print_r( $wp_query ); echo '</pre>';

PS. this is just a quick and dirty way to see whats going on. There are other tools, snippets and plugins that do this in a more organized fashion. But that's a discussion for another time.

share|improve this answer

All of those are in the Codex.


I feel guilty about posting this as an answer but it does very directly answer your questions, "Is there a trick to learning about these parameters?" and "How do I find them?"

The trick is to search the Codex, and to read the Codex. Follow the links in the Codex. Look in the source code, a link to which is provided in many, but not all, of the Codex entries.

Yes, print_r() helps a lot. var_dump() is better in that it will output information even for empty strings, NULLs, booleans, etc. Its output is harder to read, but you get used to it.

share|improve this answer
Why do you feel guilty? – Jamie Oct 16 '12 at 0:42
Mostly link answers are discouraged. – s_ha_dum Oct 16 '12 at 4:12
@s_ha_dum Shame on you! – userabuser Oct 16 '12 at 7:37

The code itself is also a great place to learn about all possible arguments. One advantage over all the other methods (including the Codexs) is that it never gets outdated. Here's the code for WP_Query: http://core.trac.wordpress.org/browser/trunk/wp-includes/query.php

The arguments you are referring to are in its parse_tax_query method.

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.