Home › Forums › ACF PRO › Previous and next get fileds › Reply To: Previous and next get fileds
gonna be honest, not sure what you’re doing there, so here’s another stab code to explain what I was doing.
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_585d2d2af8d69';
// see if this field is set
if (isset($_POST['acf'][$field_to_check_key])) {
// this field is not submitted, must be a different group
return;
}
// the new value is submitted
$new_value = $_POST['acf'][$field_to_check_key];
// get the old value
$old_value = get_field('luc_nham_0_can', $post_id, false);
// test new value to see if it's different than old value
if ($new_value != $old_value) {
// it is different
// do something
}
}
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.