如何在自定义分类中查询自定义帖子类型的帖子?在 WordPress 3.0 中

发布于 2024-09-24 22:49:15 字数 371 浏览 6 评论 0原文

我一直在到处寻找,我试图查询以查找此帖子类型中具有特定分类值集的自定义帖子。

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

我该怎么做?

我尝试过这个,但没有成功。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁的新欢旧爱 2024-10-01 22:49:15

我今天早上醒来并再次尝试。有效,为什么呢? ... 没关系。也许工作到深夜。

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

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");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文