Home › Forums › General Issues › Flush Unused Custom Fields › Reply To: Flush Unused Custom Fields
Yes it does. What my code does is this
1) It queries every table for the value that matches the ACF field key
2) It constructs a list of “name” values where one is the field name and the second is “_{$field_name}” which holds the field key
3) It deletes all of the values for this field name
This is only safe for field that will have unique names in the database. This would not be safe if you have fields that are named the same. There is really nothing that I can do about this.
It is a crude hack to do something that is really impossible to do safely without a lot of time and work involved.
This is why I added the warning and that any time you’re messing with the DB in this way you should have reliable backups of your DB.
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.