Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.

Update

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

 
discard

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.