Get updated meta data after save_post hook

All we need is an easy explanation of the problem, so here it is.

I am trying to get the updated value of a piece of meta when a post is saved (custom post type) but when I try to grab the updated data on the save_post hook, I get the previous data instead. I tried a separate function with a higher priority, but no luck that way either (below)

How do I get the updated meta value right after I save the post?


add_action('save_post_space', 'tps_save_space_slots', 20, 3);

function tps_save_space_slots($post_id, $post, $updated) {
    //Don't fire on auto-drafts
    if (isset($post->post_status) && 'auto-draft' == $post->post_status) {
    //The new slots being saved
    $allSlots = tps_generate_space_slots($post_id);

    //Update the meta
    $updateSlots = update_post_meta($post_id, 'allSlots', $allSlots);

add_action( 'save_post_space', 'tps_initiate_resend', 30, 3 );

function tps_initiate_resend($post_id, $post, $updated) {
    tps_resend_code_after_change($post_id);//<----this sends the new meta value in an email, but it's the OLD value

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Apparently in order to get the meta value right after saving the post, you have to either get the $_REQUEST[‘my_meta_value’] directly, or, if you need to update the database right away, you have to use update_post_meta() in your save_post action.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply