Remove Website URL From WordPress Comments

Are you looking to remove website URL from WordPress comments ?. I assume it’s a Yes. When you first install WordPress, you will notice WordPress comment form at the end of the post. There is no built-in option to hide website URL from WordPress comments.

While some people prefer to show website URL field, some won’t because it’s a big advantage to spammers. Many spammers use WordPress comment to get a link back to their website. You can say it is the most popular way to generate spam. That’s why most of the third-party comment plugins provide an option to hide website URL.

When you visit any blog and comment and add a URL, the link will count but it will be nofollow. However it’s a low-quality backlink and you must understand that it’s actually not going to contribute a thing to your search performance. But the spammers still tend to use this technique and comment a nice message and add their website URL.

When you install a WordPress theme, some themes provide the option to hide the website URL from comments. However with most of the themes this isn’t an option. Hence one has to use a code to hide the website URL. I will show a simple way to achieve this.

Remove Website URL From WordPress Comments

I assume your are using a WordPress theme. To hide URL field from the comments form, you can insert a code and add it to your functions.php file.

Remove Website URL From WordPress Comments

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

  • Login to WordPress Dashboard.
  • Go to Appearance > Theme Editor.
  • Select Theme Functions (functions.php) file.
  • Add the following function and click Update File.
// Remove Website URL From WordPress Comments

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

If you are using a caching plugin, clear the cache. Here is the result after adding this code. Notice the Website URL is now hidden. Hope this short tutorial helps !

Remove Website URL From WordPress Comments

In future if you want to show the website URL field, go to functions.php and delete the code that you added.

Pragati

Hi, I am Pragati. As a Technical Consultant, I help businesses harness the latest innovations in Cloud applications, Intune, Windows 365, and more. Sharing my knowledge and insights through this blog to inspire and empower others in their digital transformation. Let's revolutionize the way we work and thrive in the cloud era together!
Back to top button