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???
Maybe:
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??
Regards!
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.