Home › Forums › Backend Issues (wp-admin) › acf/save_post – execute only when value of field has changed › Reply To: acf/save_post – execute only when value of field has changed
When you submit values through a form on a web page the browser may escape special characters like single quotes. It may also convert html entities. These changes may cause the two compared values to look the same but to actually be different strings when compared.
However, looking back at your code I thing the reason for your problem is something else that I missed the last time. You need to supply the post ID when getting fields.
if ($_POST['acf']['field_5fd213a8c6dfe'] != get_field('field_5fd213a8c6dfe', $post_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!
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.