Home › Forums › Backend Issues (wp-admin) › update_value with image field: same value and old_value › Reply To: update_value with image field: same value and old_value
In this case the “Old Value” is not the value from the DB. Old value would only be different than New Value after another update_value filter change the value. Here Old value means the value that was submitted vs what the value currently is. These will always be the same unless your site has multiple filters that are operating on the field.
If you want to compare the old value in the DB vs the new value submitted then you need to use an acf/save_post action with a priority < 10. $_POST[‘acf’][$field_key] will hold the new value (an ID) and to get the old value you can use
get_field('field', $post_id, false) which will always return the image ID.
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!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.