Home Forums ACF PRO Action hook when specific field changes Reply To: Action hook when specific field changes

  • Hello James and thanks for giving a hand!

    I find interesting this “update_value” filter but I think that the “save_post” is more suitable to my needs, as long I can put all fields logic in only one function.

    How can I access a specific field old and new posted value in acf/save_post action???


    function my_acf_save_post( $post_id ) {
        // specific new field value
        $new_value = $_POST['acf']['field_abc123'];
        // specific old field value
        $old_value = get_field('custom_field_name', $post_id);
    // run before ACF saves the $_POST['acf'] data
    add_action('acf/save_post', 'my_acf_save_post', 1);

    PS: Also can I use get_fields() instead get_field() in order to get all fields old values??