So far I read all the threads and found the only way to delete the data is to recreate the field and set it blank then delete it !
It will be great if I were using a simple site with 2 3 fields that only I can control ! but currently the client I am handling have so many fields and almost most of them are user generated lets take an example,
We are using a listing website where people come and list their business with various fields generated through Flex field of acf, now the user also have the capability to delete those field and create another but there comes a problem when the delete the field it does delete from there panel but not from data base and when the loop runs it still appears any hope for solving this issue ?
ACF works mainly as a GUI (and API) for post meta (and other meta) and as such does not attempt to delete any information on it’s own.
There are situations where it would be quite aggravating to have your information being deleted with ACF fields and there are some posts here already discussing this issue.
You might find this post interesting as it suggests a solution: http://support.advancedcustomfields.com/forums/topic/database-cleanup-feedback-on-function/
The solution is indeed great, but as I stated in my question it will only work if you know what to delete and what to keep ! in my case the customers are writing the data through ACF fields and now then when they delete flexi field the data keep showing not only showing but in a very very weird way I have flexi field where people can write branches of there business some of the branches are already listed so I used the post object field to retrieve and put a conditional field that user may click not on list so he can write in text box, then I used the loop function on front end to display all the results now the problem is when user delete one of the entry it remains there, but being deleted it also over writes the manual hand entry !! because the association of the key become same, its like it do delete the associated key but not from db !
I’m sorry but I’m not sure I’m following exactly what you are doing.
Does your clients have access to wp admin in which they set these flexible fields or how does it work?
If you remove a flexible field from for example a post it should not be printing on the frontend if your code is correct 🙂
I’m going back to several old threads to report the fix for this problem. As of ACF Pro 5.5.8, flexible fields clean up after themselves when they’re deleted and no longer leave orphan data in the postmeta table.
I posted a question about your answer in a more current thread: https://support.advancedcustomfields.com/forums/topic/performance-of-backend-super-slow/#post-56310
Even with correct front-end code, this issue contributes to problems in the back-end.
I would love to see if you have more input.
You must be logged in to reply to this topic.
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!
© 2020 Advanced Custom Fields. Subscribe