开发者

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

开发者 https://www.devze.com 2023-01-17 23:50 出处:网络
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开发者_如何学C set.

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开发者_如何学C 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");


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");
0

精彩评论

暂无评论...
验证码 换一张
取 消