Home › Forums › Backend Issues (wp-admin) › Slow update for large number of ACF Fields › Reply To: Slow update for large number of ACF Fields
Yes, ACF is doing possibly two queries for every field that needs to be updated. The reason that it does it that it uses the WP function
update_metadata for each field.
I have run into this myself in the past and I now think about how much data will need to be saved before I make a decision on how to build it. With a long list like that I would now probably create a custom post type for storing that information. To be honest, I don’t know why there is such a difference between update_field() and saving through the admin.
As far as not updating… yes the page times out, but depending on the server time limit, for example if you add
set_time_limit(0) the code will continue to run till completion because PHP only checks to see if the user has disconnected when it tries to send output and it will not try to send output until the process is complete.
I could not go back and rebuild the site that had a problem but what I could to is add an acf/save_post filter that runs before ACF starts, check to see if it was the post type that was giving me problems and if it was I set the time limit to 0. Now when it times out if you hit the browser back button instead of the reload button, then wait a minute and reload the page with the group on it, it will show all of the changes. A PITA I hope to avoid myself in the future.
Anyway, I know it’s not a solution, and I can’t say what the solutions is, but I will mark this topic for the developer to take a look at and maybe he’ll be able to find a way to solve it in the future.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.