Home Forums ACF PRO Previous and next get fileds Reply To: Previous and next get fileds

  • Hello John,
    I access to the dababase and find in column meta_value, i seem something like field_585d2d2af8d69. Are they field key?

    Then i try edit your code and run test:

    add_action('acf/save_post', 'my_acf_save_post', 1);
    function my_acf_save_post() 
        // you need the field key of the field you want to check
        $field_to_check_key = 'field_585d2d2af8d69';
        $old_value = get_field('luc_nham_0_can', 339, false);  // 339 is curent post ID
        // see if it is different than new value
        // also make sure the field key is set
        if (isset($_POST['acf'][$field_to_check_key]) &&
            $old_value != $_POST['acf'][$field_to_check_key]) 
            echo 'Hello the Wolrd';      // Test if the field has changed.
      // Test current fields
      $curent_field = get_field('luc_nham_0_can');
    // Shortcode to test
    add_shortcode('tess', 'my_acf_save_post');

    I try to change the testing field many time, but $old_value has updated same $curent_field, it not keep old value.

    You can see some images in this comment.
    This is the testing field in database
    This is the post to test