Use the action created_term
. Its first parameter is the $term_id
.
It is called in wp_insert_term()
in wp-includes/taxonomy.php
after a term was successful created:
do_action("created_term", $term_id, $tt_id, $taxonomy);
do_action("created_$taxonomy", $term_id, $tt_id);
The second parameter is the term_taxonomy_id from the term_taxonomy
table, and the last parameter is the taxonomy.
So register an action with …
add_action( 'created_term', 'wpse_78858_add_color', 10, 3 );
… and your callback should look like this:
function wpse_78858_add_color( $term_id, $tt_id, $taxonomy )
{
# do something
}