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.

So I've created a little jquery cycle based feature rotator that pulls from the post_tags. I added the post tags to my other custom post types like this:

register_taxonomy_for_object_type('post_tag', 'reviews');
register_taxonomy_for_object_type('post_tag', 'interviews');
//...

When I add a 'featured' tag to one of my reviews and one of my interviews, and query for it thusly:

$query = new WP_Query( array( 'post_tag' => 'featured' ) );

I get two random posts instead of the two expected results. Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Take a careful look at the arguments for WP_Query. By default, it queries for the post type post.

To select your custom post types, you need to change your query a little:

$query = new WP_Query( array(
    'post_type' => array( 'reviews', 'interviews' ),
    'post_tag'  => 'featured' 
) );
share|improve this answer
    
Doh! it's always something simple isn't it? Thanks I have been banging my head against a wall! –  Jeff Lauder Jul 3 '12 at 17:46

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.