The WordPress codex page for query_posts states that it does not cover all the parameters which query_posts takes:


This is not an exhaustive list yet. It is meant to show some of the more common things possible with setting your own queries

I couldn't find a reference of all the parameters which are accepted by query_posts, though, even in just a simple list form. Is there a cheat-sheet or something similar available with this data?

  • You should never use query_posts, it is bad practice, use WP_Query or the pre_get_posts filter instead
    – Tom J Nowell
    May 26, 2015 at 21:57

3 Answers 3


Below is everything from WordPress 3.0.1 found in the parse_query() function of /wp-includes/query.php (lines 1246-1550).
However, it's possible for a plugin to add parameters and so a list can never be fully complete:

  • attachment
  • attachment_id
  • author
  • author_name
  • cat
  • category__and
  • category__in
  • category__not_in
  • category_name
  • comments_popup
  • day
  • error
  • feed
  • hour
  • m
  • minute
  • monthnum
  • name
  • order
  • orderby
  • p
  • page_id
  • page
  • paged
  • pagename
  • post__in
  • post__not_in
  • post_status
  • post_type
  • preview
  • robots
  • s
  • sentence
  • second
  • static
  • subpost
  • subpost_id
  • tag__and
  • tag__in
  • tag__not_in
  • tag_id
  • tag_slug__and
  • tag_slug__in
  • tag
  • taxonomy - (pre 3.1)
  • tb
  • term - (pre 3.1)
  • w
  • withcomments
  • withoutcomments
  • year

    Pre WP 3.1

  • meta_key
  • meta_value

    Since WP 3.1

  • fields
  • meta_query
  • tax_query
  • I was JUST looking for this list yesterday!
    – Dan Gayle
    Aug 11, 2010 at 22:09
  • 2
    If you could re-edit your question and make it community wiki, we could all keep it up-to-date when things change. Parameter types (formats: int or string?, multiple values?) would also be nice.
    – Jan Fabry
    Aug 12, 2010 at 7:36
  • @Mike - I've added some missing query vars into your answer and also added some new 3.1 query vars in.
    – t31os
    Mar 7, 2011 at 10:23
  • @Mike - No problem, i'm sure there's a couple more missing, but seeing as we've covered the important ones i wasn't going to nit pick over having every last one(there's a good few in there that noone will ever use already - sentence or second are two i've never seen used)... :)
    – t31os
    Mar 8, 2011 at 0:04
  • @t31os - FYI I'm currently working on a plugin that will make sure of all of these, and more which I am very excited about. It's a next generation URL routing plugin. Interested? Mar 8, 2011 at 5:56

If you can read PHP code, you can take a look at the function parse_query($query) in class WP_Query of file wp-includes\query.php

The supported arguments are all listed and managed there.

  • 1
    +1, the code is the authoritative reference. (Not the codex, or the function comment/docblock.) Aug 11, 2010 at 21:10

I use the Codex page for WP_Query. http://codex.wordpress.org/Class_Reference/WP_Query

The list may not be exhaustive but it is useful, fairly comprehensive and up-to-date. I believe that WP_Query and query_posts share the same parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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