WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a fairly unexciting custom type (Event) and an equally vanilla custom taxonomy (Venue). Whenever a user creates an Event, I want them to be required to either create a new Venue or select an existing Venue. How can I make this a required field when publishing?

It seems like the sort of thing that should be rather trivial but I've been going up and down http://codex.wordpress.org/Function_Reference/register_taxonomy and haven't found anything obvious. Am I going about this in the wrong way?

Any assistance would be appreciated.

share|improve this question
up vote 0 down vote accepted

You can hook an 'init' action callback in which you get the post-type and if it's 'event' check $_POST for if your taxonomy value is empty. If it's empty, you can then reset $_POST['action'] to 'edit', so that post.php simply reloads the editor. And you can inject $_GET['message'] = 11 and add your (11th) response message via hooking a callback to the 'post_updated_messages' filter. That's not ideal, but it's somewhat of a solution.

share|improve this answer
I've been looking around for the last week and this really appears to be the only solution. Maybe a useful direction for a new plugin. – Robert Drake Feb 28 '11 at 14:04
@Robert Drake: I think this should be somehow addressed in core. It's kinda similar to another wish i have...which is ability to specify taxonomies as unique, by which i mean you can only select one value per post. There's a certain level of input logic that one can't define easily in WP, so far. – wyrfel Feb 28 '11 at 14:09

Your Answer


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.