Home › Forums › General Issues › Delete all repeater rows? › Reply To: Delete all repeater rows?
In my case, I just wanted to complete empty my repeater field so I tried “delete_field($field_key, $post_id);” because I am constructing an array and i am using add_row to put the array into the field. My setup got a little complicated with repeater inside of repeater inside of repeater. Seemed the best approach was construct an array and use add_row.
The delete_field seemed to do the trick, but is that a good way to completely remove all values from a repeater? That is exactly what I wanted it to do. Tested locally and appears to work.
All other methods like delete_row() didn’t seem to work, it was always left with something in the repeater. I tried looping through and deleting rows, still same issue, it always left something behind.
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.