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

This query works in some places, but not in others... right now it's not working on the home page. This query is in a file that is included into index.php of my theme.

The regular posts show, but no cutom post types. What's wrong with this query?

$args = array(
  'post_type' => array('post', 'video', 'slideshow', 'poll', 'quote'),
  'orderby' => 'date', 
  'order' => 'DESC'
); query_posts( $args ); 
share|improve this question
Update: if I remove post from the types... the rest load, but I still need both. – matt ryan Jun 2 '11 at 14:19
My own stupidity is to blame... the query was fine, it was the posts per page limit that stopped me from seeing the 'missing posts'. Apologies! – matt ryan Jun 2 '11 at 14:31

Check that index.php is indeed being used, it's last resort kind of template when there is no more suitable one.

If you need this in multiple places across the site it might be better to run this in some hook, rather than in template file.

share|improve this answer
It is the index that is being used. Even if I use a hook instead, wouldn't the query be the same? Strangely, if I reduce the post_type array to a single class of custom post types that type will display. – matt ryan Jun 2 '11 at 14:10

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.