If you’ve ever wanted to use the WP_Query class to query the database and want to bring back all the posts for a certain post type then don’t forget to use the correct argument.

By default WordPress will use the number that’s been specified in the settings (the default is 10).
So, when your constructing your query be sure to include showposts in your argument – like so:
showposts => -1
I spent an hour working out why it was only showing 10 posts, so this post is so you don’t have to!
If you have any ‘duh’ moments (doesn’t have to be with WordPress) then please put them in the comments below as the chances are other people (me) have had them too!
Posted on January 9, 2012 in WordPress



Your views…