How to remove the url field from the comment form

If you have ever run a blog, you must have faced the problem of comment spam. Spammers engage in comment spam for link building purpose.

One simple way to discourage spammers is to remove the url field from the comment form. This will ensure that spammers cannot use your comment form for link building purpose.

In this post I will share a small snippet which will remove the url field from your comment form.

I recommend you to use the code snippet plugin in order to run this piece of code. Using the code snippet plugin ensures that your changes remain intact even after you change your theme.

Snippet

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

 

Explanation.

The code is self explanatory. All we are doing is filtering the comment form output and removing the url field associated with it.

This is how the modified comment form will appear in the Twenty Twelve Theme.

Snippet for Genesis Theme framework

If you are using genesis framework then the above snippet will not work. The reason is that Genesis Framework handles the comment form output differently. So instead of hooking into core wordpress filter, we will hook into the filter provided by the framework.

Modified Snippet. 

function spice_remove_comment_website_url($fields) {
 
		unset($fields['fields']['url']);
		return $fields;
}



add_filter('genesis_comment_form_args','spice_remove_comment_website_url');

 

We use this snippet on this very blog.

The main difference here is that we are hooking to the filter provided by the Genesis Theme framework. Another difference is the way we are handling the $field array.

Using Plugins.

In case you are not comfortable with the code then you can use a plugin to remove the website url field. Here are a couple of them , Remove comment url Box and Disable hide comment url 

Thats it. As you can see it is quite simple to remove website field from your comment form. Do let us know if you have any questions.

Did you enjoy this article?
Get Awesome with WordPress. Subscribe and get awesome stuff delivered straight to your inbox.
I agree to have my personal information transfered to Mad Mimi ( more information )
About Ankit

This is the author box where I get to brag about myself. So here it goes.


My name is Ankit and I am an entrepreneur. I currently run a couple of internet business. If you want to know more about me and my business then check out my personal website .

I love wordpress and I have started SpiceWp to share useful tips and tricks for wordpress. I have also developed and released 10 wordpress plugins till date. My goal with SpiceWp is to take it to a hundred thousand visitors a month mark.

If you want to join me in this adventure then lets talk.

Speak Your Mind

*