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 soif(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/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.