Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
    
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

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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