When you load the form (backend or frontend), the fields will be filled with the saved (old) value. So, if there’s no new value set in the field, the $_POST data should contain the old value.
Regarding your second question, if you check the database you will see that gallery field is saved as serialized image IDs. If you check the posted data, you will see that it is posted as an array of image IDs. And if you try to return the value using the
get_field() function, you’ll see that the data is composed of an array of image objects. This is why I said that you need to make sure that you make the comparison with the right data.
I hope this makes sense 🙂
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!