Blog Comments are a great way to engage with readers. But, no wonder, spam comments are one of the most offending aspects of the blogger’s life. Problem right? Learn how to remove the website URL field from the WordPress comment form.
Seldom people like to comment on blogs, just for the sake of sharing their link through the blog post comment form. Backlinks are good only when created with the right intention and strategically.
What makes Webmasters Submit a Spam Comment?
As you might have already received a lot of comments with weird keywords. It could be anything like, “Social Media Plugins, “Best WordPress Courses” “Best WordPress plugins” “Car Insurance” “Make Money Online” and “Bridal Makeup Artists” in the name field.
Although most of the spam comments are done through the bots only, a few comments are completely irrelevant and done manually as well. Few examples
What do you think? Why do they do so? I know you already got the idea.
The answer is SEO(Search Engine Optimization). Let’s break this down and understand it even more closely.
The default WordPress comment form plugin comes with four fields, and it’s common for every WordPress blog.
- Your Name
- Email Address
- Website URL and
- Comment section
Such comment backlinks are generally no-follow. But, certainly, helps in many ways in SEO and driving traffic. Of course only if done right.
So we have the answer now, how to stop these spam comments and save a lot of time moderating them. There are several ways, we will talk about one in this article, removing the WordPress URL field.
How To Remove URL Field From WordPress Comment Form
If you have a bit of coding knowledge, you will understand that it can be done by removing the URL code in functions.php or comments.php. Although I never recommend editing the parent theme.
Any edits should be done only in the child theme, so as not to face the consequences of a website crash or probably WordPress theme update issue.
In this blog post, we will take the help of the Code snippet plugin, which can be used for any of your other future theme edits too.
- Search for the Code Snippet plugin from the plugin area. Install and Activate it.
- Navigate Snippets >> Add New from your WordPress Dashboard. An input box will be visible.
- Give an appropriate name and paste the below code in the box.
- Finally, click on the Activate button to see the code in action.
add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}
function tu_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
There you go, it would not take any time to remove the website URL field from the comment box. Check the below screenshot.
I have tested this code on a few of the popular WordPress themes and works well in all. This particular tutorial is created on one of my favorite themes GeneratePress.
No questions, why is this my favorite? The whole world knows. why it be anyone’s favorite 🙂
Final Words On Removing URL Field in WordPress
We are fortunate enough that some anti-spam plugins prevent your blog from such automated and spam comments. Antispam is one of them, which I like.
But, even those have some limitations and can not block all the spam comments.
Moreover, some comments are done manually, which looks spammy too. As there would be some keywords stuffed in the name field and the comment is not relevant to the blog post at all.
In certain scenarios, this trick of removing the website field from the comment form would work great.
What are your thoughts on the same?
Relevant Read– How to Add Lazy Load Comments in WordPress
i am using jetpack for comment section. Is their any way to hide website field their.