The first reason for spam comments is getting backlinks. The spammers use bots to make comments on hundreds of blogs quickly.

Their intention is to put a link on the “Website Field” of the comment form. And this is why they try to make comments on your blog.

Clickable author link that came from website-field
Author link that comes from “Website Field”

So if you remove the “Website Field” from the comment form, it will discourage the spammers to make a comment on your posts. Because they will not get any backlinks from their comments.

Write the following code in your “functions.php” file to remove the “Website Field” from the comment form:

// remove website-field from comment form
add_filter('comment_form_default_fields', 'remove_website_field');
function remove_website_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}

However, this will not block the spammers by cent percent. It will discourage the spammers & bots to make a comment on your post because they will not get any benefits from their comment.

But there are some novice spammers who may not care about it and they will still make spam comments. And you have to manually go through each comment and mark it as spam.

I introduced this method because some people don’t want to use plugins and like to write code instead.

But if your intention is to block spam comments, see another post to learn more.

Spammers find your website before the web crawlers and search engines. No matter if you are a new or old blogger, the spammers always try to make comments on your posts to get backlinks. Even it’s a “Hello World” demo post, they will make comments everywhere.