Support

Account

Home Forums General Issues saving different value than $_POST['acf']['field_xxx'] Reply To: saving different value than $_POST['acf']['field_xxx']

  • From your code above

    
    add_action('acf/save_post', 's4f_save_post_step_content', 20);
    

    At priority 20 ACF is done. ACF runs at priority 10. This means that anything you do after will not be overwritten by ACF.

    
    $_POST['acf']['field_6052632c663f5'] = $new_calc_total_collected;
    

    This will have no effect whatsoever. As I said above. ACF has finished looking at these values on priority 10 so changing these values will not effect what ACF has already done with them. You are changing them at a point where the values no longer matter. Processing of this array has already been completed.

    if you add an action with a priority < 10 like this

    
    add_action('acf/save_post', 's4f_save_post_step_content', 1);
    

    This will happen before ACF looks at what is located in $_POST['acf']. Making changes to this array at this point will cause ACF to save the changes you make.