The Vault

How to Automatically Clean Up Spam on Your WordPress Site

WordPress’ companion spam blocking tool, Akismet, does a fantastic job of weeding out spam from legitimate comments, but what happens? After some time, your spam comments could number in the thousands, bloating your database size, slowing down comments management, and making baby angels cry.

In my experience, on certain shared servers, simply emptying your spam folder if it has many thousands of comments can bring the server to its knees, resulting in time-outs and a spam folder that isn’t any more manageable than before your efforts to melt your server into oblivion.

While it would be great if WordPress had a clean-up feature — like it does with the trash folder — to keep the number of spam comments at bay, fortunately for us dealing with it on our own is rather easy. Simply include the following code in your theme’s functions.php file (or custom_functions.php if you’re using Thesis 1.8.5, as you should be), and your blog will begin automatically cleaning up spam twice a day, keeping your comments table far more manageable.

One reply on “How to Automatically Clean Up Spam on Your WordPress Site”

Join the Discussion

Your email address will not be published. Required fields are marked *

Comments must be made in accordance with the comment policy. Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>