How to Remove URL Field From WordPress Comment Form

31 Aug, 2023

If you have a WordPress website, I am sure you know how painful it is to combat the massive automated spam attacks. If you have decent traffic to your WordPress website, you will surely start seeing spambots attacking your comment section area. And the spam bot attack will continue to grow and give you a severe headache unless you stop them.

This blog post will tell you why you are getting spam attacks on your WordPress website and ways to prevent them effectively.

Why Are Spammers Targeting Your WordPress Website?

It’s nothing personal. These spammers don’t know you personally, and they did not mean to hurt you as an individual. It’s pretty typical behavior and falls under a common cyber-attack vector online. And you must be ready to handle such attacks if you have a website published online.

Spambots are targeting your WordPress website for various reasons. Getting a backlink from your website is the prime reason they get aggressive. Once their comments are approved, their comments will be visible on your website, and many people will click on them to visit their website.

Their website may contain so much harmful software like adware, or there will be hundreds of advertisement banners popping across the page. In both cases, the visitors generated by your website will likely be potential money-making assets for the spammers.

Backlinks from a reputable website are an SEO ranking signal as well. It builds the trust and reputation of their website. So, in other words, spammers treat it as a win-win situation for themselves.

That means if they get any clicks from your website to their website, they will earn revenue through advertisements and sharing harmful content. If they do not get any clicks, they will be getting decent backlink juice from your website. So, in both ways, they are happy, and they win.

Strangely this is called a Black Hat SEO trick, and most of the time, this won’t work as per their expectations. Google is smart enough to understand those Black Hat SEO tricks and punish those websites.

Yet the spammers are still running the spam comment bots.

How Do Spam Bot Attacks Affect Your WordPress Website?

Below are the significant consequences of a spam attack on your website: If you allow spambots to publish spam content on your website, what’s the result? The number of spam comments could be increased exponentially. Your visitors will hate the entire website, and no one will want to revisit it.

Visitors to your website will flow away, leaving your website useless. All the major search engines will block your website, and no one will visit your website. Suppose all the major search engines denylist your website. In that case, it will only be a matter of time before your website will be equally suitable to be dead.

If your websites are originating clicks to these potentially harmful websites, you cannot run any advertising campaign effectively. The advertising costs will be rise. Either your cost per click will be increased, or you will not be able to run the advertisements at all. Thus the victim of an attack will be you.

Also, you will be experiencing high bandwidth and CPU usage. If these spambots knock on your website, they will eat up your server resources.

This will add up to your hosting bill. Many hosts will even suspend your website if too many bots visit it. Because when they allow you to host your “under attack” website, their resources will suffer. Their IP reputation may be in danger due to the attacks.

You see, there are many reasons to avoid spambot attacks.

Let’s Remove URL Field From WordPress Comment Forms

So now you know there are so many reasons these spambot attackers are targeting your WordPress website. From a spammer’s point of view, one of the attractive elements is the spam comment form with a website URL field. This lets the spammers increase their comment count quickly. So you probably want to remove this website URL field from your website.

So now we will see how we can disable it for the good of your site.

There are many ways to prevent spam attacks on your site. And in this tutorial, we focus on only removing the website URL field from your WordPress website comment form.

Removing URL Field From WordPress Comment Section to Prevent Both Human and Bot Submission

Specially designed automated bots are used to carry out such large-scale spambot attacks. Because there are billions of websites on the web, running a human-operated spam network is technically impossible and financially challenging.

But there is human-operated spam distribution activity also, and there would be a couple of reasons for doing that.

WordPress Contact Form With Website Field

I will give you a quick example to understand. Suppose you are running a website that attracts some decent traffic. And then there will be people who just started blogging or just started their e-commerce website. In most cases, they may not have enough resources to run paid advertisements and hire affiliates or marketers to grow their business.

Show what they will do? They will use these spamming as a way to attract potential customers. So they will come to your website and submit their comment along with a link to their website. Once those comments are live, they will likely get visibility and traffic to their website.

So removing the website URL field from your comment form will help you prevent automated spam and human-made activities.

I will show you how to remove the website address field from your form section on your WordPress website in this next section.

So, How to Remove Website URL Field From WordPress Comment Form?

I will show you two easy methods to follow so that you can quickly remove that site URL field from your WordPress comment form. One of the examples will be using your theme’s default function.php file, and another method will use a dedicated code snippet plugin.

Both will work well so that you can choose based on your preference. Using either of the options will prevent your form from displaying the website address field.

Remove Website URL Field Using functions.php File

Every WordPress theme will have a file called functions.php. And within this PHP file, we can add your custom functionality to make your website customizable as per your taste and requirements.

Before you start editing this functions.php file, I strongly recommend activating a child theme of your current theme. Then the customization that you have added to this functions.php file will be preserved. Otherwise, all your customization will be overwritten when an update is installed to your parent theme.

So now I assume that you have a child theme already activated.

Now go to the Tools menu and click on the Theme File Editor link. Now you need to click on the functions.php file from the right side.

WordPress Contact Form Website Field Remove Functions PHP

And now, scroll down to the bottom of the file and paste the below code snippet.

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
       return $fields;

Once you are ready, click on the Update File button, and WordPress will save your changes.

When you reload any of the pages containing a contact form, you will no longer see a field to enter the website URL.

WordPress Contact Form Website Field Removed

Remove Website URL Field Using WordPress Plugin

Suppose you are not interested in creating a child theme and maintaining it. In that case, you can use a dedicated code snippet plugin to insert this code on your WordPress website.

We need to install and activate the Code Snippets plugin.

WordPress Code Snippets Plugin

Once you’ve activated this plugin, go to the Snippets menu and click on the Add New link.

On this Add New Snippet page, please enter a meaningful title here so later you can understand the code snippet and its functionality.

And now paste the above code into the Code input area you see on this page.

WordPress Contact Form Website Field Remove Code Snippets Plugin

Make sure you have selected Run snippet everywhere. It will be selected by default.

You may give a proper meaningful description and tags here to understand them in the future easily.

Now click on the Save Changes and Activate button.

Upon reloading your page, you’ll see the website URL field has disappeared instantly.

If you cannot see the changes you’ve made, then there is a chance that your cache is not cleared yet. So you will need to make sure to purge the cache to see the changes.


Combating automated spam is a massive problem for every WordPress website owner. There are so many ways you can prevent spam from coming to your WordPress website. You can use many plugins and tricks like implementing a ReCaptcha system on your contact form pages.

However, most of those automated preventions will not block a human-generated submission. Removing this website URL field from your WordPress comment form will be the only solution to prevent that kind of junk.

You can combine the method explained in this blog post with a reliable spam prevention plugin. I have listed helpful anti-spam plugins so you can pick anyone from that list.

Have you used this handy trick to stop spam from coming to your website? Do you have any excellent way to prevent spam, including user-generated spam on your WordPress website? Please leave them in the comment section below so that our community can get help from that.

Suppose you are looking for a reliable and super-fast WordPress hosting server with tons of premium features. In that case, I recommend you buy a subscription plan from Rovity and host your website. I am sure that you will love our service and your website will be much faster than now.

Jafar Muhammed

Jafar Muhammed has 10+ years of experience in WordPress, web hosting, domain names, DNS, CDN, server administration, etc. He is an open web advocate. He is the CEO of Rovity, the fastest-growing premium shared hosting startup in India.

Related Posts

Check Out These

We just wanted to let you know that you might find the following related posts interesting. If so, keep reading 😉