Home › Forums › General Issues › Flush Unused Custom Fields › Reply To: Flush Unused Custom Fields
if you look at my try to achieve this:
You see that ,expect some field that i didn’t found a way yet, can be made in 2 ways, one is as john say delete all the meta related to ACF on acf/save_post hook at high priority.
The other a more difficcult way is to match the field in the database/json and then to delete the field that is not present anymore in the current saved data.
I found a trick also to check if the field is a flexible field and delete the field.
As far as i test works remember to backup db first.
For now works on post and custom post type when i have time i want also to include a “Clean all ACF” tool that use this method, and i’m trying also to find a way to “clean” all the fields for taxonomy, user etc etc.
Suggestions, ideas and pull requests are welcome.
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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.