Support

Account

Home Forums General Issues Update_field not working on post update Reply To: Update_field not working on post update

  • @hube2 Thanks for responding 🙂

    I added the following:

    
    $field = get_field_object('notification_record');
    var_dump($field["key"]);
    exit;
    

    which gave me ‘field_57cee83c43f92’ as the key

    so I updated my code here and it’s still not saving 🙁

    
    function do_something_on_save( $new_status, $old_status, $post ) {
        
        //echo get_the_ID(); //returns 13
        //exit;
    
        //$field = get_field_object('notification_record');
        //var_dump($field["key"]); //returns 'field_57cee83c43f92'
        //exit;
    
        update_field(
            'field_57cee83c43f92',
            'checking',
            13
        );
    }
    add_action( 'transition_post_status', 'do_something_on_save', 10, 3 );