How to remove website (URL) field from WordPress comments?

WordPress bloggers who loves content sharing and engaging their followers uses comment section to express opinions of other fellow bloggers and readers. But that comment section is also the most spammed section in the WordPress, as you know there are end numbers of annoying scrappers, auto comment bots, and similar tools that spam the WordPress’s comment section for free back links.

The only way to limit such kind of spam comments to either install an anti spam plugin which is not user friendly (annoying for authentic users) or removing the website field all together like below one.

WordPress comment section

I know the second one is way more useful if you really want to get rid of those spam comments. In this article we’ll see how to remove website (URL) field from WordPress comments.

Add the following code in the theme’s function.php file and save it:

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

Make sure you backup the site before adding the above code.

To see the immediate effect remove the cache (if any) and load your website in view some recent articles. You’ll notice that the website field is gone from the comment section.

Category: .

Leave a Reply

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