Remove website URL field from WordPress comment form

Help others by sharing this article

In this article, we will learn how to remove website URL field from WordPress comment form without plugin. While there are plenty of plugins that can be used to prevent comment spam, they do not always work as expected. It is best to deal with comment spam at its source by preventing spammers from adding links in the first place.

We all know that WordPress is the best content management system. It is very easy to use, and it requires minimal technical knowledge. There are many advantages of using WordPress as your website’s content management system.

Why should you remove website URL field from the comment form in wordpress?

To answer this question, let’s first understand what comment spam is. Comment spam is a form of spamming on blogs, wikis, and online discussion boards where spammers post irrelevant comments with a link to their site or product. And if you don’t have a way to prevent this type of spamming, then it can be very annoying for your website visitors and for you as well.

Spammers can place a link to their site in the comments box and gain SEO benefits. This can also hurt the SEO of your site if you have too many low-quality links coming into your site.

Steps to remove website URL field from WordPress comment form

Before getting start, take a full backup of your website, it will help you to restore your website in case you break your site while editing functions.php file. If you do not want or are confident to edit funcions.php file directly then use a free plugin called Code Snippets.

I recommend you create a child theme as if you edit your parent theme files and when theme developer releases an update, then your customization may be overwritten. You can use a free plugin called Child Theme Configurator to create a child theme (you can delete this plugin after creating the child theme but do not delete the main theme or parent theme).

1). Go to Theme File Editor which is under Appearance. Then click on ‘functions.php‘ file.

how to access theme file editor
how to access theme functions or functions.php

2). Add below code in functions.php file then click on ‘Update File‘.

/** 
 * remove website url field from wordpress comment form
*/
add_filter('comment_form_default_fields', 'wpamit_remove_url_field');
function wpamit_remove_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}

The code should be look like below image.

wpamit remove website url field from wordpress comment form without plugin

That’s it. The above snippet will help you to remove website URL field from wodpress comment form without any plugin.

You may also want to check out our guide on Remove WordPress Version Number Without Plugin, Automatically add WordPress image alt text without plugin, Change WordPress Admin Dashboard Footer Text.


Help others by sharing this article

Leave a Reply

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