Home › Forums › ACF PRO › Previous and next get fileds › Reply To: Previous and next get fileds
from you original post, what you want to do is detect if certain fields have changed, and if they have to run some code.
add_action('acf/save_post', 'my_acf_save_post', 1);
function my_acf_save_post($post_id) {
// you need the field key of the field you want to check
$field_to_check_key = 'field_012345678';
$old_value = get_field('my_field_to_check', $post_id, false);
// see if it is different than new value
// also make sure the field key is set
if (isset($_POST['acf'][$field_to_check]) &&
$old_value != $_POST['acf'][$field_to_check]) {
// value has change
// call function to do calculations
}
}
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.