How to Remove Website URL From WordPress Comments without plugin?

Many spammers are using WordPress comment to get a link back to their website, It is the most popular way to generate spam. You can hide URL field from the comments form by adding a simple function to your functions.php file.

You can also create a WordPress custom functions plugin to add all your custom functions, Google analytics and other codes.

If you are wondering What is Functions.php File in WordPress and How to Edit it?, We already have explained it.

To hide URL field from the WordPress comments form, simply add the following code to your functions.php file.

  1. Login to WordPress Dashboard
  2. Go to Appearance > Editor
  3. Select Theme Functions (functions.php) file.
  4. Add the following function and click update changes.

// Disable Comments URL field
function jlwp_disable_comment_url($fields) { 
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','jlwp_disable_comment_url');

That’s all, you need to do to hide the URL field from the WordPress comments form.


You May Also Like

2 responses on “How to Remove Website URL From WordPress Comments without plugin?

  1. Prabhu Ganeshan

    The biggest problem in the comment section is spammers post a website URL that is not related to our niche. I manually review each comment because sometimes I receive good comments. And also some of my clients don’t like Site URL. Now I’m using the plugin to hide URL section and in future, I will use this method to hide URL on clients site. Thanks for sharing simple method.

  2. Freddy G. Cabrera

    Hey what a neat way to get rid of the website field for the WordPress Comments!

    I personally don’t mind it. I actually like people linking back to their blog homepage as long as it is a relevant website to mine.

    Thanks for sharing this trick! ๐Ÿ˜€

    Cheers! ๐Ÿ™‚

Leave a Reply

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