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

WordPress 3.2.1. I want to query several specific posts that are part of a custom taxonomy. This is what my query looks like for retrieving one post, using the id for that post.

$args = array(
    'post_type'=> 'portfolio',
    'skill-type'    => 'the-letter-d, food, kids-meal',
    'p' => 56
query_posts( $args );

This works for just getting one post, but I'm looking to get multiple posts. I've tried using 'post_in' => array(56,40,7...etc) in place of 'p'=> 56 and it didn't work. I'm assuming that doesn't work with custom post taxonomies or else I am just doing it wrong?

I've also tried using the following, removing the terms list since it's not really needed.

$args = array(
    'post_type'=> 'portfolio',
    'post_in' => array(56,40,7)
query_posts( $args );
share|improve this question
up vote 0 down vote accepted

If you are retrieving post(s) by ID, then why do you need terms in query? Post IDs are unique. You likely need post type (because it's not default), but taxonomy terms only add confusion to the mix.


Noticed after you added second code sample - post__in has two underscores in it, your examples lack one more.

share|improve this answer
You're right, I probably don't need the skill types. Those are left over from when I was simply calling the latest ten posts from any of those terms. I had to list the terms in that version because there were a couple that I did not want to include (theres one called Retouching I did not want included). I've removed them and it has no effect on using 'post_in' => array() to call more than one post, however. – hbuchel Sep 1 '11 at 23:10
Ouch, what a dreadfully small thing to miss. Two underscores indeed is what was wrong. Thanks Rarst. – hbuchel Sep 5 '11 at 17:56

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.