How to remove all Spam and Pending Comments in WordPress

WordPress has always been the choice for serious as well as amateur bloggers. Due to ease of management of server and client side makes it the signle most preffered choices for many bloggers. It is one of the best opensource content management system. It I developed by dedicated sets of developers. It is constantly updated and well supported.

This means so many of sites are now using WordPress as the content management system. This attracts spammers to create automated tools to send spams to websites built upon WordPress. There are so many antispam plugins available in WordPress plug in the repository. Akismet from the makers of WordPress becomes single most preffered by many.

It has been seen that from time to time spammers use some sopphisticated technologies to bypass, antispam technologies employed by plugins. In this way, they can send a large number of spam comments and make the server to act as the denial of service.

They use many tools to provide spams into comments. Many times webmasters use to find so many useless comments that are flooded into the content management system.

It overloads caapcity of server and then it leads to shared hosting mostly to crash. There are many built-in tools inside WordPress Administration to stop these advents of unwanted comments. If you find that floods of oceans of comments are pouring in then first stop your website from accepting comments before making any amends to this.

First prevention for the short-term duration is to configure your comment system or use plugin to stop accepting comments to your website.

How to configure your website to stop accepting comments:

Login to WordPress Admin
Tick the “Users must be registered and logged in to comment” checkbox
Click “Save changes” button.
Then reach to 
Uncheck the checkbox “Any one can register”.

In this way, you are not allowing visitors to register to make comments.

This means from now on there will not be any spam comments. But what if you want visitors to make comments and at the same time want spam messages to stop. Then read on.

Use WordPress to remove spam comments:

If you look carefully with the functions attached with WordPress Administration you will find that there are so many easier functions for almost every task.

Go to Comments from the sidebar of WordPress Administration:
Click on Spam
There you will find an EMPTY SPAM BUTTON.
Click on that button to delete all spam comments all at once.

Most of the times antispam plugins flags spam as comments and all of these spam comments are stored inside here. So, it is easier to delete all spam comments all at once by following the above method.

The disadvantages associated with using built-in Empty Spam feature of WordPress Administration:

It is esier to do this function which is written above. But these functions of Empty Spam is not automated. One need to do this from time to time. If that interval duration becomes longer then you might find difficulties in deleting. It might happen with the underpowered server.

If your server does not have content delivery netowrk and it is not connected with it. The content delivery network has the capacity to stop denial of service attacks. If your website is getting many spams then within short time duration you would never know how much spam comments will accumulate and make your server load heavily.

If the hacker finds ways to bypass antispam plugin then automatically you will receive tons of spam comments as legal comments. This will load the server hugely. When any spam comments approved as legal comments then there is no single button to delete all legal comments. This means you will have to do this one by one and that will take huge time indeed.

Run the following SQL command on your database:

There are other methods through which you can delete all spam comments. Log in to the WordPress backend. It is cPanel and then go to phpMyAdmin and then run SQL commands to delete spams. You can find these SQL commands simply by searching the internet. Next, locate the tab where SQL is written. Click on it. Then run the commands to delete spam comments.

The command is this:-

To remove all pending comments:

DELETE FROM wp_comments WHERE comment_approved = "0"

To remove all spam comments:

DELETE FROM wp_comments WHERE comment_approved = "spam"

In this way, you can either remove spam comments or remove all pending comments one at one through the command line of the database through the back end of the server.

Modify .htaccess to prevent automated bot posting of spam comments:

Automated internet bots take almost half percentages of internet traffics. It is important to modify .httaccess so that these automated bot referrers should be stopped before they enter into WordPress front end. WordPress front end is the WordPress Administration.

Generally spams work through reffeer and once you stopped these refferrer throguh .httaccess then there will be significantly lesser presence of spams in WordPress administration.

# Protect from spam bots
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Replace with your site address just like in my case.

WordPress does provide huge room for developers to block spams with its widely configurable options. One need to follow these in order to make most of fight out spam as the webmaster you have plenty of options to configure WordPress through the front end and back end to stops spammers and spam bots from making mayhem into your server.

As the webmaster, the prime focus is to present visitors the faster loading of the website so that there will not be any lagging factors associated with it. While doing this there are several bottlenecks such as the presence of spam bots which could take the large chunk of server resources.

By following either of these methods one can secure one’s site comprehensively from the spammer. The disclaimer to this is that user should adopt these on their own discretion only. It is important to back up website and files so that there will not be any such difficulties for returning back to the site if during the course of modifying files site becomes offline.

Related Posts:

How to Automatically Insert Content After Each WordPress Post?

The Beginner’s Guide to Technical SEO

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.