How To Remove The URL Field From WordPress Comments Form

WordPress

You may have noticed that some WordPress blogs have a comment form but not a URL field in it. Spammers generally fill your blog with spam comments just to get backlinks in the comments section. Even if you have moderation enabled, you will have to go through lots of spam comments and delete them. So removing the URL field from the comment form helps us to protect the blog from these spammers. This is the reason why many authority blogs remove the URL section from the comments form. This must be done if you have auto-approval of comments turned on in your blog.

How to Remove URL field from WordPress Comments by editing code

Removing the URL field from the comment form is an easy task if you know how to edit or modify code. You can use this code and add it to the functions.php file. The functions.php is located in the theme’s folder that can be found in the wp-content -> themes. You can either use File Manager of cPanel or FTP to get access to this file. If you want to edit the file from the WordPress dashboard, Navigate to WP Admin -> Appearance -> Editor and select functions.php to add the following code.

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider
add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}

This code creates a function unset_url_field and removes the URL field.

Remove URL field from WordPress Comments with a plugin

If you do not know how to edit code or are afraid of doing this, you can try a nice WordPress plugin that will remove the URL from the comment form automatically. This plugin is disable-hide-comment-url. After installation, it will remove the URL option from the comment box. You can also install Remove Fields or Remove Comment Website/URL Box plugins for the same.

By following the above methods, you can remove the URL field from the comment box and prevent spam bots from your blog.

If your WordPress-based blog is the constant target of comment link spam and you don’t get much time to moderate the comments, you can think of removing the website field from the comment section to discourage the link spammers. In case you do not want to remove the website field, you can install a captcha plugin and add a captcha in the comments form to discourage bots that autofill comments. I won’t prevent people from manually putting spam comments but can reduce automated bot comments.

If you know any other easier method of doing this task, you can share it with us via comments


Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.


Similar Articles

0 Comments

Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker