Home › Forums › Add-ons › Repeater Field › update_field() will not remove lines from repeater › Reply To: update_field() will not remove lines from repeater
If you look at ../advanced-custom-fields/pro/fields/class-acf-field-repeater.php line 812 (function update_value) you will see that ACF gets the old number of rows and makes a comparison after updating and then deletes any access rows.
Performance wise, updating a repeater with 15 rows of 27 fields will not be faster even if you delete everything first, in fact, deleting everything first will reduce performance. Updating his repeater will mean a minimum of 812 queries. Deleting it first will double this to 1624 queries.
ACF calls update_metadata() for every field, not just once. each sub field on each row of the repeater is stored separately and each must be updated independently.
More than likely, the reason that the excess rows are not being deleted is that with this number of queries that need to be performed the request simply times out before it can get to that point. It’s likely failing long before it has even done all of the updates.
There have been many discussions on this forum about the performance of large repeaters.
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 PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.