I'm taking my first foray into plugin development and have got confused pretty quickly. I'm attempting to make a simple plugin that stores hex colours against terms, so you can assign a colour to a tag or category and then use that in a theme.
What I cant figure out is how to get the term_id of a newly created or edited term. I've bolted on a form to 'edit_tag_form' with a colour picker and can access these values through $_POST, but if it's a newly created tag I don't see how my code can know the ID of the newly created one. I need to know the term_id to be able to link it with the hex colour and save it to wp_options.
I'm using the action hook 'edited_term'. I guess for edited existing terms I could get the tag_ID from the query string, but I want to be able to assign colours immediately to newly created tags/categories.