How to Completely Stop Spam Comments from Bots in WordPress?

Comments spam is one of the biggest problems for WordPress bloggers. There are two types of comments spam you may receive on your blog. One is the people leaving their website URL with irrelevant message while other is from automated bots. You can easily send comments to spam or trash section using plugins like Akismet. However, your server resources will be still wasted as the comments are posted on the blog. Also, you need to manually or schedule cleaning up the spam/trash comments which is a time consuming task.

Automated Vs Human Comments

Similar to the login page, WordPress also has a common PHP file for allowing POST requests for comments. Anyone can automatically post a comment by sending name, email, URL and message to yourdomain.com/wp-comments-post.php. Since this is a common approach WordPress follows for all installations, more than 90% of comments you receive on your site will be from automated bots.

It is necessary to stop these spam comments from bots to protect your site and save your time.

Stop Spam Comments from Bots

There are plugins like Akismet help to handle spam comments in WordPress. However, Akismet will not stop bot comments, it will only send the comments to spam/trash section. You still need to delete the spam/trash comments manually which need lot of time. In addition, you need API key to setup Akismet plugin and need a WordPress.com account.

The best and less know option is to use Forget Spam Comment plugin. Simply, go to “Plugins > Add New” section in your WordPress admin panel. Search for “Forget Spam Comment” and install the plugin on your site.

This plugin does not have any settings to configure and it will simply stop bot comments after installation.

How Forget Spam Comment Plugin Works?

The difference between user and bots is simple. Bots will directly access the /wp-comments-post.php file and post the comment. However, users will load the page and scroll down to the comments section for leaving a comment. The plugin will delay the PHP file /wp-comments-post.php when the page loads and add a hash code to the file. This will prevent bots from directly posting comments on your site while allowing users to submit comment.

Below is the video from plugin author explaining how the plugin works.

As seen in the video, the plugin will add a query based on the CSS selector “commentform”. Plugin author also includes the selector for popular themes like Astra. However, if your theme uses custom CSS selector for comment form then this plugin will not work. In addition, after installing the plugin make sure to clear your cache and post a comment to test everything is working on your site.

Leave a Comment