Home › Forums › Add-ons › Repeater Field › update_field() will not remove lines from repeater › Reply To: update_field() will not remove lines from repeater
first, I’m not a developer of ACF, just someone that knows a lot about it.
When ACF is updating a repeater it does not know what rows have been changed. As you can see by looking at the code it then calls update_row(). Update row in turn calls update update_field() on each field in the row. To not do the update ACF would need to get each value of each sub field and test it against the new value and update if changes. This would not reduce the number of queries. This is exactly what the WP update_metadata() does, if ACF actually did this check itself before calling update_metadata() for a field this would mean a doubling of queries performed when a field needs to be updated.
What you are missing is that each field is stored independently. Each sub field on each row requires updating independently. There in no flag or any way to know if the value has changed without doing a query of the database to get the existing value and compare them one at a time with the new values. This is an inherent design issue in the way that WP handles the updating of meta fields that has always existed. Any design that has hundreds of custom fields will have performance issues when updating.
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.