1

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 forgot to mention - I'm using a drop-down field to display the taxonomy terms when creating a post. – Emzo May 23 '11 at 21:08
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.

  • Hmm, not so straight-forward. Another idea I had was to use the save_post hook to check if a term had been selected, and if not, I could add a default term from the taxonomy. – Emzo May 23 '11 at 21:11
  • That's actually really easy to do, this snippet is a good place to start: wordpress.mfields.org/2010/… – mfields May 23 '11 at 21:50
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.