Support

Account

Home Forums General Issues acf/save_post not working with calculated update_field Reply To: acf/save_post not working with calculated update_field

  • I don’t know of any reason why the fields are not available in the second function. The priorities should be working as you expect them to. I still think that some of the fields are not being saved during the first function and I still think that if you’re using the first function as you originally posted that my previous comment still applies.

    I’ve just looked back over your code and it is a problem in the first function.
    get_fields($post_id); will only return fields that have already been created in the database. So if there are fields that are not set when the post is initially created, they will not exist and will not have values. This means that $replace = get_field($field_name, $post_id); will never run on a field that does not already exist in the DB so if(empty($default_value)){ is never true.

    At this point I thing you should submit a support ticket and see if they can help you figure it out https://support.advancedcustomfields.com/new-ticket/