Home › Forums › Backend Issues (wp-admin) › Update ACF fields in WordPress admin using Ajax › Reply To: Update ACF fields in WordPress admin using Ajax
Your AJAX function is updating the values in the database but this will not show these updated values without doing something more. You are expecting the live page to automatically be updated but that will never happen.
1) Refresh the page
2) Return all of the updated field values in the response and a JSON array (field key => value pairs) and they in your jQuery code for success:
update the values on the page using the ACF JS API
In fact, you should not be updated the database values at all, you should be requesting the values for the post and populating the fields and then letting ACF do the updating when the post is saved, it’s going to happen anyway a second time. The only think you’re accomplishing by updating it is slowing the response time down.
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.