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

How to enforce the selection of at least one term from a custom taxonomy?

programmeradmin5浏览0评论

I have a custom taxonomy, and would like to force the user to select at least one term from that taxonomy when creating a post in the WordPress admin back-end. Is this possible?

I have a custom taxonomy, and would like to force the user to select at least one term from that taxonomy when creating a post in the WordPress admin back-end. Is this possible?

Share Improve this question asked May 23, 2011 at 20:56 Emyr ThomasEmyr Thomas 3612 silver badges8 bronze badges 1
  • I forgot to mention - I'm using a drop-down field to display the taxonomy terms when creating a post. – Emyr Thomas Commented May 23, 2011 at 21:08
Add a comment  | 

3 Answers 3

Reset to default 0

No. This is not completely possible. One solution would be to swap out the default UI on /wp-admin/post.php & /wp-admin/post-new.php. You can provide the user with radio buttons or a select box. This will work relatively well, but can not be 100% trusted. There is still the possibility that a user could remove all terms via quick edit in /wp-admin/edit.php.

I know this is years later, but in case it helps anyone else, I found this plugin:

Require Post Category

Although it only applies to built in category, it is very easy to modify to suit a custom taxonomy.

Again a few years later here's another plugin to enforce taxonomy/category/tags selection

WP Required Taxonomies – Categories and Tags Mandatory

Works with gutenberg too as per plugin description

发布评论

评论列表(0)

  1. 暂无评论