WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Very simple, where would I hook/filter to alter the users selection of terms when they save a post (Update or Add)?

I need to hook in all instances; such as when saving a post via AJAX, saving when JavaScript is disabled and a normal POST is done and when posts are saved via quick edit.

share|improve this question
up vote 3 down vote accepted

It is always 'save_post' (or 'wp_insert_post' immediately after this). In $_POST['tax_input'] you will find all the terms for all taxonomies associated with the current post.


'tax_input' => 
  array (
    'location' => 
    array (
      0 => '0',

To change the terms you have to call wp_set_post_terms( $post_ID, $tags, $taxonomy ); manually, just changing these values will not work because they are set when the actions fire.

For an existing post that is updated you can hook into 'edit_post' and 'post_updated'.

Parameters for all these actions are $post_ID, $post in this order. For 'post_updated' there is a small change: $post_ID, $post_after, $post_before.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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