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

2 Answers 2


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.


Try edit_post_${post_type} hook

  • 2
    Please elaborate a bit: Explain what it does, and how to use it. Right now your answer isn't even comment.
    – fuxia
    Oct 19, 2022 at 15:52

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.