0

I want to do some stuff when a category is created the only hook i could find is

add_action( 'edited_category' , 'custom_term_saved', 10, 2 );

but it is only called on edit form saved not on create form saved

0

There is a hook that can be used for any taxonomy, create_{$taxonomy}, which in your case, is a category. So, it would be create_category:

add_action( 'create_category', 'my_function', 10, 1 );

This is triggered by wp_insert_term() at line 2142.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.