最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom taxonomy - Admin only taxonomies?

programmeradmin0浏览0评论

I'm building a marketplace site using woocommerce, wcvendors pro, buddyboss marketplace and buddypress.

I'd like for the admin to have an admin-only taxonomy that she can use to tag/categorise certain products for use in featured blocks on the home page, for example.

What would be the best approach for this? Thanks!

I'm building a marketplace site using woocommerce, wcvendors pro, buddyboss marketplace and buddypress.

I'd like for the admin to have an admin-only taxonomy that she can use to tag/categorise certain products for use in featured blocks on the home page, for example.

What would be the best approach for this? Thanks!

Share Improve this question asked Dec 29, 2020 at 20:45 Austen OsborneAusten Osborne 571 silver badge6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

When registering the taxonomy just set public to false, and it' won't be accessible on the front end. Just make sure to specify show_ui to true, otherwise it will use the public value and be hidden.

register_taxonomy(
    'my_taxonomy',
    'product',
    [
         'public'  => false,
         'show_ui' => true,
    ]
);

If you're registering the taxonomy with a GUI from a plugin it should have checkboxes for these options.

发布评论

评论列表(0)

  1. 暂无评论