Search code examples
wordpresstaxonomy

How to query posts for a custom post type in a custom taxonomy ? in wordpress 3.0


I've been looking everywhere, I'm trying to query to find the custom posts which are in this post type with a particular taxonomy value set.

register_post_type('toy',$args);
register_taxonomy( 'age_group', 'toy', array( 'query_var' => true, 'hierarchical' => true, 'label' => __('Age Group') ) );

How can I do this?

I tried this, but it didn't work.

$recent = new WP_Query("age_group=test&post_type=toy&showposts=5");

Solution

  • I woke up this morning and tried it again. It works, why? ... nevermind. Maybe working too late into the night.

    $recent = new WP_Query("age_group=test&post_type=toy");