Home Forums Backend Issues (wp-admin) [plug-in] ACF cleaner [free]


[plug-in] ACF cleaner [free]


    For those who are interested;

    I made an ACF cleaner plug-in, which cleans out those thousands of empty / orphaned database entries, created by ACF.

    Please notice;

    I created the plug-in for my own workflow (I want a clean database, not filled with useless, empty, orphaned revisions) so it may not suite everyone (see on GitHub for the details).

  • A lot of people do look for something like this, so I’m sure it will be popular.

  • I was looking for it as well;

    ACF is great, but it really meshes up your database.

    It even creates empty records (two for every entry) of empty values and it’s revisions… when you save an empty value and do some revisions on the same page, your database will explode with useless entries.

    The project started as a stand-alone script (outside the WP environment), than I decided to run it by cronjobs, after that I realized it was more easy to wrap it into a plug-in.

    So that’s why the code is a mix of plain-vanilla PHP and some WP-API’s 🙂

    The only restriction is that your field-ID’s are prefixed with “ACF__” or “acf__” because I use this as an identifier for the queries.

    Feel free to port; it’s completely open source.

  • Personally, I don’t really worry about the database and the empty entries unless it’s causing some type of a bug or issue with proper operation. The WP database is properly optimized and empty values will not usually cause any performance problems. But I have seen people as how to get rid of the empty values and it will help me to give them a place to go rather than tell them how difficult it is to add.

  • As a suggestion, if you’re looking to get more traffic, I’d do some searches in google for related topics and post information on any forum topics you find here about your plugin. I’m sure that you can find many of them if you look and you’re interested.

  • Well, I don’t care about “some” useless entries 🙂 but your database can really become huge, when not cleaning up some stuff.

    I am now adding a new feature to this plug-in (so you can use it without a fixed prefix) and (as a test) deleted one ACF field… I ended up with over 60 orphaned entries…


    So I am happy with the option to delete those records – when I delete a field, I also want to delete the values (I realize this is not for everyone, but I want to have the choise).

  • – update – You can now set your own record-prefix (defaults to ACF__) for the field #ID’s.

    ACF cleaner #ID

  • I was sooo excited to find this but unfortunately does not work on WordPress 5. Good effort it is definitely needed/required and I hope you do update it in the near future.

  • Are you sure this has something to do with WP5.x?

    I checked the plugin against a couple of WP5.x sites and the plugin did work.

    Maybe something else is wrong?

    Can you provide an error message or “something that did not work out as aspected” ?

  • thank you for the quick response

    I literally get no error, when I go to TOOLS – ACF Cleaner it redirects me to “Page Not Found” so I cannot even grab an error for you.

  • Well, technically that’s an error 🙂

    The page / URL should be something like this;


    And the page requested should be on your server (check it by (s)FTP) like this;


    Of course the last part (/wp-content/…) is the most important for now.

  • The link on that is: /wp-admin/acf-cleaner/acf-cleaner-admin.php

    on the link you gave it gives: Cannot load acf-cleaner/acf-cleaner-admin.php. message that is on: /wp-admin/tools.php?page=acf-cleaner%2Facf-cleaner-admin.php

  • That’s kinda weird…

    Is the plugin menu-entry nested inside the tools-sections, like this;

    ACF menu

    Or not at all?

    Maybe it’s a conflict with another plugin?

    The issue you describe looks a bit like this (solved) one;

  • you are the man!
    Step 1. disable the plugin
    Step 2. rename the folder to “acf-cleaner” so remove “-master”
    Step 3. enable plugin
    IT WORKS! You are a superhero! Thank you!

  • I will update the file with this manual 🙂

    Please, keep in mind that the plug-in works best when there is a solid “prefix” for your ACF-entries in the database.

    Something like ACF__logotype / ACF__reviews / ACF__4901-31A, etc…

    When you do not have a consequent prefix, the plug-in is unable to find all ACF-fields available.

  • Yes I noticed that, with my luck I used very unique names for the two fields and it’s discardable fields after the post is submitted we don’t actually need to store the information AND the new fields are new, they literally have a new naming convention/group so I could clean up like 100k of them no problem.

    Thank you again!

  • I don’t think the plugin works (properly?) for flexible content.

    We make heavy use of flexible content, they are called “flexible_content_”. Under those we have ‘content blocks’ that make up the content, but many of those content block fields can be/are empty.

    So querying all “flexible_content” resulted in 250.000+ results, however they are almost all classified as Orphans, when they’re not and still being used on many active pages. Barely any resulted in ‘Empty’.

    Testing and deleting the orphans resulted in many of the content being deleted (test environment, no problem).

    It’s also a multisite but I doubt that is the issue, the plugin successfully identifies the table and prefixes.

Viewing 17 posts - 1 through 17 (of 17 total)

You must be logged in to reply to this topic.