Home › Forums › Backend Issues (wp-admin) › How to create calculated fields › Reply To: How to create calculated fields
Hi there,
Your code seems good.
As you said, if you’re calculating your “total_return” into first snippet only, your calculation is working.
Why don’t you update all your field in a single snippet (your first one) ?
If you really need to use different snippets for each field, maybe you could add different priorities to your actions.
See documentation: https://www.advancedcustomfields.com/resources/acf-save_post/
So keep your first snippet without modifications (default priority is 10).
And try adding a priority of 15 for your second snippet :
add_action('save/post' 'my_acf_update_total_return', 15);
Let me know if it helps,
RemSEO
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.