Home › Forums › Bug Reports › ACF PRO: Possible bug in acf/save_post › Reply To: ACF PRO: Possible bug in acf/save_post
What I’m trying to do is compare the old and new values of a field when a post is saved using acf/save_post with priority 1, which is supposed to run before ACF saves the $_POST[‘acf’] data.
The field values always comes out equal, which they are not supposed to do, right?
Example data:
field_abc123 old value: Title One
field_abc123 new value: Title Two
Example code:
function compare_field_values($post_id) {
// Print old and new field values
var_dump(get_field('field_abc123', $post_id);
var_dump($_POST['acf']['field_abc123']);
// Exit to be able to debug the field values
exit();
}
add_action('acf/save_post', array($this, 'compare_field_values'), 1);
So, anyone have any idea on how to solve this? Or is there a bug in ACF when setting the priority to 1 on acf/save_post?
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.