I'm trying to do something when a category is added to post and saved. I thought that using the save_post hook would have registered when a category is added to a post, but it doesn't appear to.

When I edit a post and do nothing but change the categories for the post, I don't get the save_post hook fired (editing the title, body, etc fires the save_post hook successfully). Is there another way to use add_action/add_filter to detect when a category is added to a post?

1 Answer 1


You may want to try:

do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);

You can find it under this Docs and the action is located at wp-includes/taxonomy.php


function wpse5123_set_object_terms($object_id, $terms, $tt_ids, $taxonomy){
       if($taxonomy == 'category'){
           echo '<pre>';
           echo '</pre>';

The code above isn't tested but I think you get the point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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