How to remove the website field from WordPress comment?

WordPress users often notice spamming on WordPress sites generated by the comment section. The comment section already has four fields. These are comment text, name, email and website fields.

This is a common fact for WordPress users to often find spam comment text. But sometimes we also see spammers spam using the website field of the comment form. Their main motive is not for writing a quality comment, they just want to use the website section for spamming purposes.

The name of the user who comments on your WordPress post becomes a hyperlink with the website link that the user provides. But sometimes it can be found they are not putting their real name.

On one of my blogs, when I had the website field enabled, I found names like “Best web hosting” and similar to these types of spammy names. All these were linked to the URL. The URL is the link, user provided in the website field in the time of writing the comment on a post.

Surely, commenting on your post with a promotional or spammy type name without using the real name is a black hat SEO technique. Also, you don’t know if these websites have the good authority or not.

Finally, I decide to remove the website field from the comment form of my WP site. From that day I remove that field, I notice the decrease of comments which implies the intention of commenting.

How can you remove the website field from the comment section of WordPress?

Removing the website field from the WordPress comment section is quite easy. You just need to write a few lines of code to disable the website field from WordPress comments.

Below is the simple code that can do this task:

function cs_remove_comment_website_fields($fields) {
   unset($fields['url']);
   return $fields;
}
add_filter('comment_form_default_fields','cs_remove_comment_website_fields');

Just put the above code in your theme’s functions.php file or you can also create your own plugin where you have to put the same code.

In the above code, you can see that we have created a function and we have unset the url field inside the function. Then return to the fields. After that, we passed the function to the comment_form_default_fields hook via filter hooks.

Now no more irritation of spam comments. Smile and best of luck. Thanks for reading this post.

Also, read:

 

Leave a Reply

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