Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Function Reference/query posts

Curious about the "Template Tag" Location of this Page

I am curious as to why this section is filed under "Template Tags" instead of function reference or something of that ilk. User:Lyzadange 09.25.2009

Probably just left over from old days where any function users would likely put in themes were called Template Tags. --MichaelH (talk) 12:10, 25 September 2009 (UTC)


Housecleaning: deleted old talk stuff that has been resolved for years

Cleared out most of the talk for this article because it was painfully old and out of date. Most issues have been very much resolved with the growth of the article Jeremyclarke 21:35, 19 December 2009 (UTC)

Examples should come after parameters, moving

I'm going to migrate the 'examples' section to below the parameters definitions. The Usage section at the top covers the basic principles of query_posts and its annoying to scroll through so many examples when using the article as a reference. Jeremyclarke 21:37, 19 December 2009 (UTC)

So where IS a definitive list of parameters you can pass

I'm finding it's really hard for a noob to get started with all these docs - they're about as scattered as the WP codebase is... Once a dev finds this page, where does he go to get a comprehensive list of all the parameters you can pass? Aside from opening up and figuring out the source of course...

+1 Jwk 14:31, 28 March 2013 (UTC)

Note: This function isn't meant to be used by plugins or themes

To the best of my knowledge this is not true. When used correctly there is nothing wrong with using query_posts in themes or plugins. There are cases where it makes more sense to use query_posts as opposed to its alternatives.

Showing only one category on homepage example

I realized after I added this code example that it doesn't actually use query posts, but is something that could be used instead of. Where else in the Codex would be a good place to put this? Because I spent a couple of hours searching for this function today only to find thousands of other people looking for the same solution and not finding much. Having it somewhere in the Codex would be a good thing.


Since it uses the 'pre_get_posts' action, I think you should add it to that page instead. It looks like there is already an example there for excluding categories, this could go right along with that.
-Jdgrimes 12:55, 28 March 2014 (UTC)

Moved, thank you!