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’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.

    I’ll look into how you can work around this….