Spam in website comments has become a real scourge, in fact, there are people on the Internet who live through these systems, so read this to learn how to stop comments Spam on your WordPress website. If you enable comments on your website, you will need to take care of Spammers because as soon as you make a certain number of presence and page views, Spammers and Blackhat SEOs will visit you.
These Spam comments are so useful for those who make them because they bring links from sites with a good reputation and good numbers, and equally deleterious for those who suffer them because they bring a bad reputation and drop in the indexing of search engines and in particular of Google. To prevent your site from losing the appeal it has gained over years of effort, you will need to find an effective and definitive way to stop Spam in the comments of your pages.
For WordPress users, there are many simple tweaks to make to block or hide these comments before your visitors see them. You can even use a robust anti-spam plugin to bolster your defenses or rely on manual editing of certain files. So let’s see how to stop these annoying enemies of the good Internet!
Avoid Spam in comments so as not to fall the indexing of your site on search engines
As your site becomes more popular, you are bound to receive more and more comments and Spam is likely to become a sensitive issue. There are many types of Spam in comments nowadays, most of it is automated and published by BOT, in particular, there are short and generic messages looking for the possibility of including links that refer to Spammers’ sites.
Most often, these comments include malicious links, designed to trick visitors into providing personal information, or that lead to particular sites. Clearly, it is vital that you do everything possible to prevent comment Spam from appearing on your WordPress site as this would seriously damage your reputation and plummet your site’s indexing on search engines.
First thing to do. Disable Trackbacks in WordPress to reduce comments Spam
One of the main reasons people leave Spam in comments is to get trackbacks. In reality, they are unnecessary for us and we can safely disable them to fix the root problem. This is an easy way to significantly reduce Spam in comments, and you can choose to disable trackbacks on the entire blog or in a single post.
Just go to the Settings → Discussion to make this change. Here you can uncheck the ‘Allow link notifications from other blogs (pingbacks and trackbacks) on new posts’ tick.

This will disable trackbacks for all new posts, but you should also disable trackbacks on existing posts by selecting all posts and changing their option.
Stay safe and keep Spam comments from showing up
The first and foremost thing to do is to prevent Spam comments from appearing on your site. So let’s use systems to avoid this: you can simply use Askimet (Used by millions of websites, Akismet filters out hundreds of millions of spam comments from the Web every day. Add Akismet to your site so you don’t have to worry about spam again) to immediately quarantine Spam comments or use an alternating and self-managed comment system like Disqus (The internet’s favorite comment plug-in makes it easy for publishers to bring their content to life, fuel colorful discussions, efficiently moderate comments, and build engaged communities).
Reduce the number of links allowed per comment
Most Spam in comments is designed to add links in the comment section and trick people into clicking on them. An easy way to combat Spam is to allow fewer links in comments.
From the WordPress dashboard, you can go to Settings → Discussion to make this change. Look for the Comment Moderation section:

Here you can change the number of links allowed per comment in WordPress.
Here you can decide how many links will be allowed in a comment before it is flagged for moderation. The advice is to reduce the number to zero so as to require moderation for any comments with links. The legitimate ones you will make visible manually, and the Spam will be put out of the game.
Create a words blacklist for WordPress post comments
In addition to the classic links, Spam comments contain recognizable or easily identifiable keywords. To prevent them from appearing on your website, you can simply create a blacklist of words and your site will flag any comment that contains one. A simple step to how to stop Comments Spam on your WordPress website.
To do this, go back to Settings → Discussion in the WordPress dashboard and find the Disallowed Comment Keys section:

Here you can enter your word list – the comment blacklist – in WordPress is a good way to stop comment spam and will make your job a lot easier.
When a comment is posted that contains any of these words, it will be sent directly to the trash. Of course, it’s important to choose the words on your blacklist carefully so that you don’t delete comments from legitimate visitors.
For tips, you can check the recommended WordPress comment blacklist on GitHub.
Disable HTML in your WordPress comments system
By default, WordPress allows certain HTML tags within comments and these can be used to hide spam links. You can eliminate the problem by simply disabling HTML in your site comments.
This means that any HTML tags used in a comment will appear as text, but they won’t work, meaning the links won’t be clickable.
To achieve this, you need to add the following code to your theme’s functions.php file.
function wpb_comment_post( $incoming_comment ) {
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
return( $incoming_comment );
}
function wpb_comment_display( $comment_to_display ) {
$comment_to_display = str_replace( ''', "'", $comment_to_display );
return $comment_to_display;
}
add_filter( 'preprocess_comment', 'wpb_comment_post', '', 1);
add_filter( 'comment_text', 'wpb_comment_display', '', 1);
add_filter( 'comment_text_rss', 'wpb_comment_display', '', 1);
add_filter( 'comment_excerpt', 'wpb_comment_display', '', 1);
remove_filter( 'comment_text', 'make_clickable', 9 );
This code changes the HTML code into HTML entities, so the Spam HTML codes are not displayed as HTML in the comment and not parsed by the browser. Problem solved with How to Stop Comments Spam on your WordPress website article.