Since WordPress has become the most preferred choice of many webmasters around the world, it is extremely vulnerable to spams and hackers. Though there are various ways to combat spam comment in WordPress such as installing Akismet plugin, there are times when these spam comments make their way to your site. Moreover, an unsatisfactory visitor may use inappropriate tools to post hundreds of thousands of unnecessary comments on a site which often lead the site to crash.
Whatever the reason may be, it is always suggested to remove spam or inappropriate comments from your website to prevent it from crashing after a server overload.
We have listed 3 ways in this tutorial to help you delete bulk spam comments from your site without overloading the server.
1. In-Built Method
Wordpress itself comes with a powerful method to help you get rid of spam comments in bulks.
Go to Comments → spam. In the spam comments section, you will encounter an “Empty Spam” option in the right corner of the page. Click on the button to instantly delete all the spamcomments.
However, the whole process of deleting hundreds or maybe thousands of comments through this method takes a lot of time and can cause slow web server. In fact, if you are hosting your website on a shared server, you may get timed out error while deleting and even cause the server to crash. In addition, this method does not remove any spam comments that are in pending state. Thus, you can only remove comments which are flagged as spam.
2. Using a plugin
Wordpress plugins play a crucial role in the working of a WordPress website. Whether you are looking to extend the functionality of your website or merely change the look and feel of the theme, WordPress plugin can easily make your website stand out from the rest without ever making you edit a single line of code. And deleting spam comments is no exception.
To make the process of removing bulk spam comments from your site easier and convenient, you need install Batch Comment Spam Deletion.
Batch Comment Spam Deletion
The plugin basically modifies the inbuilt Empty Spam feature in the WordPress. The plugin, instead of deleting all the comments at once, deletes them in batches of 100 comments. Once all the comments are deleted, it will navigate you to the comments page automatically. Batch Comment Spam Deletion minimizes the load on your web server whilst letting you quickly delete all inappropriate and unnecessary comments from your site.
3. SQL Command
If you are familiar with database and SQL Commands, you probably don’t even need to use any plugin or Empty Spam feature of WordPress. You can simply go to your website’s database and empty comments tables as per your needs.
As an instance, in order to remove all the spam comments, you can use the following command.
DELETE FROM wp_comments WHERE comment_approved = “spam”
Use the SQL box to execute the SQL command.
Removing spam comments is important to keep hackers and security threats at bay. Though anti-spam plugins are enough to keep your site safe from spammers and hackers, it is still a best practice to get rid of any of the spam comments that may have slipped into your site by emptying your spam box.