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 need to create a hook after the creation, edit and deletion of a taxonomy organizing a custom post type I have. I've noticed though that I can't use the following actions with those taxonomies:

add_action( 'create_category', 'some_function' );
add_action( 'delete_category', 'some_function' );
add_action( 'edit_category', 'some_function' );

It would be ideal if I could use these because I only really need the ID of the category to do the process I had in mind. Is there some argument I can pass in with register_taxonomy() that will allow those actions to be associated with taxonomies of custom post types? Or is there some way to simulate these hooks in another way?

Any help is greatly appreciated.

share|improve this question

What you're looking for are the create_$taxonomy, edit_$taxonomy and delete_$taxonomy hooks. $taxonomy is, of course, your taxonomy name.

add_action( 'create_your_tax', 'wpse32510_create', 10, 2 );
funciton wpse32510_create( $term_id, $tt_id )
   // do stuff

There's also create_term, edit_term and delete_term.

Best place to find hooks: http://adambrown.info/p/wp_hooks/

share|improve this answer
This works fine, but is there a way that the action can fire when adding an associated custom post type to it via the post's edit screen? Sort of like how when you add a Post to a Category it fires the edit action. This currently doesn't happen for some reason. – jimlamiell Nov 1 '11 at 0:57

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.