WordPress: Create New Taxonomy Action Hook

You may want to do something in WordPress with an action hook when a new, custom taxonomy is created or edited.

Unfortunately it seems like there is no documentation on this in the WordPress Codex that I could find.

There is the create_categoryand edit_categoryaction hooks though and since categories is a taxonomy you can use the same concept for custom taxonomies so your action hook will be create_{taxonomy}and edit_{taxonomy}accordingly.

For example, let’s say you have a custom taxonomy named “stores” the action hook will be create_stores. Here is a code sample:

function my_create_stores($term_id = null) {
	$term = get_term($term_id);
add_action('create_stores', 'my_create_stores', 10, 1);