We analyze the post of the selected post types against the ACF groups in use. Afterwards we remove all data from deleted groups.
There’s a dry run available (discovery) to see how many fields would get removed. On the actual cleanup you get prompted because it can’t be undone (so make a backup first).
This plugin was initially created for our own usage to clean a big database from old ACF data.
Check out the GitHub repository and submit pull requests or open issues
The plugin can be found it the WordPress Plugin Directory. Search for „ACF Cleaner”.
- Upload the entire
/wwd-acf-cleanerdirectory to the
- Activate „whatwedo ACF Cleaner” through the ‘Plugins’ menu in WordPress.
- Do a database backup manually or use a third party tool
- Go to „Tools / ACF Cleaner”
- Select the post types you want to clean and run it
What about conditional fields
Conditional fields are not taken in account at this point. This is probably also the issue why there’s nothing like this baked into the ACF plugin itself. Down the road it gets pretty complex.
Output the names of the deleted fields
We are aware that it would be handy to know which exact fields will get deleted, so the user can analyzing the actual data. This could be integrated in a future release.
We already know the name of the fields and we’re also returning them from the server. Since they’re a lot of unordered data, we don’t do something proper with those in the frontend .
Support more than just post meta
ACF allows fields for term meta, user meta etc and not just post meta. This plugin only works with post meta for now.
There’s a ticket in the WordPress Support page for this: https://wordpress.org/support/topic/support-more-than-just-post-meta/. We’re happy to accept pull requests.
Contributori și dezvoltatori
„whatwedo ACF Cleaner” este un software open-source. La acest modul au contribuit următoarele persoane.Contributori
- Prevent error when no clone field is used (thanks to melcarthus for reporting)
- Find more orphans (repeater and clone fields)
- Improve loading of plugin when included via a theme
- Return notice when Advanced Custom Fields is not installed
- Show more CPT in the list (also not public once are visible now)
- Add single post metabox with detailed info for unused fields (thanks to TrilipuT)
- More precise unused fields detection added (thanks to TrilipuT)
- Add check if Advanced Custom Fields is installed (thanks to sebastian_a) for reporting it
- First release