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