Home › Forums › Bug Reports › Flexible Content data still in wp_postmeta after layout removed › Reply To: Flexible Content data still in wp_postmeta after layout removed
Actually, while you may delete a repeater row and it does not repopulate if you add a new row, that row is still in the database until it gets overwritten, at least that’s my experience.
When ACF is updating a post it loops through $_POST[‘acf’] and inserts/updated the actual fields submitted. Since your deleted rows are not part of this array ACF is not aware that they exist at this point, which is why they do not get deleted.
To be honest, I’m not personally concerned about the left over data in the database. I’m not even sure there’s a solution, or at least not an easy solution, other than having your own filter that does the data deletion that is built to work with your fields the way you’ve built them.
I’ve currently got a site with so many fields on one post type that it times out during a normal save. If ACF attempted to delete all the unused data every time I think this would happen more frequently and put a severe limit on the number and types of fields you could have. This is because every update to post meta created a new DB query. That is an inefficiency in WP core because there isn’t currently a way to delete, update or insert multiple meta values at the same time.
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!