Are there any actions I can hook into for update_post_meta()? I don't see anything obvious in the source. Woocommerce lets you change the featured status of items via ajax from the edit screen. I am using a transient to store the featured items in lieu of querying them every time and I'm deleting that transient on the save_post hook, but it isn't getting fired because of the ajax function that directly updates the post meta. Worst case I can unhook woo's action and recreate it myself with the delete transient call, but I'm wondering if there is another hook i could use.


1 Answer 1


(See codex) update_post_meta() calls

update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value);

This function is here. And there are plenty of hooks/filters:

(In example of 'post', $meta_type='post')

Before metadata is updated:

update_{$meta_type}_metadata (here) Filter

-If this returns anything other than 'null', the metadata won't save

update_{$meta_type}_meta (here) Action

After metadata is updated:

updated_{$meta_type}_meta (here) Action

updated_post_meta (here) Action

-For posts only

All the actions take ($meta_id, $object_id, $meta_key, $meta_value) as arguments. The filter filters a $check and takes the above as additional arguments.

  • appreciate you posting the answer even though it was a duplicate question. sorry about that! Commented Apr 26, 2012 at 15:27

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.