HomeSEOHow to Remove Website URL Field from the WordPress Comment Form
How to Remove Website URL Field from the WordPress Comment Form
January 26, 2022
Over the course of my two years working on the WP Mayor blog, I’ve noticed that many commenters used the comments section to secure backlinks to their websites. We have been using spam detection plugins, but some human comments always sneak through. Ever since I have been mulling over ways to combat comment spam.
In a recent team meeting, Prithu, our new Editorial Manager, brought something to my attention:
WordPress automatically asks for commenters’ website URL in all submissions.
It was a lightbulb moment! We suddenly realized that there was a very simple solution to disable the comment URL for all comments.
Well, people submit spam comments to try and improve their SEO. They do this by adding their website URL. In this way, they’ll get a backlink from your site. They believe that the more backlinks from reputable sites they get, the better their SEO score.
This is a blackhat SEO trick and for the most part, it doesn’t work. However, every blog owner will tell you that they receive tens of spam comments every day nonetheless.
WordPress’s default comment form includes the following four fields: name, email, website URL, and the comment box.
To help prevent comment spam, we’ll be removing the website URL field listed above.
In this solution, we’ll be using the following code snippet.
You can manually place this in your theme’s functions.php file or use a snippets plugin to be safer. Keep in mind that if you don’t know what you’re doing, you can easily change something in the functions.php file and harm your website.
In this case, I’ve used the Code Snippets plugin. Simply install and activate the plugin on your website, and add a new snippet.
Type in a title and add the code. Activate the snippet and you’re good to go!
To check out the final result, view the website in incognito mode on your web browser.
Spam comments are a huge problem for all blogs. In this article, we’ve seen how to remove the website URL field from your WordPress comment forms using PHP code.