Search

How to Remove Website Field from Comment Form in WordPress

There may be many times when you expect feedback or a reply from the visitors to your posts, turns out you have to deal with a bunch of spam comments which may lower the quality of your comments section and make your site appear less professional. One of the trademark characteristics of spam comments is irrelevant links. These URLs may lead users to malicious sites where they could become victims of cybersecurity attacks. And for that reason, you may want to remove the website field from the WordPress comment feature.

The default comment setting which you can tweak at Setting Discussion from your WordPress dashboard let you take control of some of the comment systems such as allowing comments on new posts or imposing requirements to fill out a name and email to comment. However, to remove the website field, you may need to use another method which we will show you later.

In this article, we will show you how to remove the website field from commenting feature in two ways:

Removing Website Field from Comment with a WordPress Plugin

Whenever you want to add an additional feature or want to solve some issue on your WordPress site, the first place you may want to try is the WordPress plugin repository (wordpress.org). To remove the website field from your commenting feature, you can check out the Advanced Comment Form plugin by Thomas Maier.

The Advanced Comment Form plugin allows you to remove the website and email field from the comment form and insert custom text before or after the form.

Removing the website field with the plugin is very easy. First, you need to install and activate the plugin. Once activated, navigate to Comment → Comment Form from your WordPress dashboard then continue by activating the remove website field option by ticking the checkbox. Finish by saving the changes by clicking the Save Changes button.

Removing Website Field from Comment Without Plugin

This time, we will show you how to remove the website field from commenting feature without using a plugin. Instead, you will use a custom code to achieve that task. However, before you start, you may want to back up your site and use a child theme to avoid breaking the parent theme or losing your changes when you update your theme.

Once you’re ready, navigate to Appearance  Theme File Editor from your WordPress dashboard (if you use a block theme, you can find the theme file editor under the Tools menu). Once you’ve arrived at the Edit Themes page, open the functions.php file from the Theme Files list by clicking it. Continue by copying the following code:

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

You can place the custom code in your functions.php file under the PHP tag <?php and outside of any existing function.

Once the code is in place, save the changes by clicking the Update File button at the bottom of the page.

Now, your comment feature will lose the website field which was the target for spam comments irrelevant and malicious URLs.

The Bottom Line

Unfortunately, not everything goes the way you expected from the commenting feature of WordPress. You may often have to deal with a bunch of spam comments with irrelevant links on your WordPress site instead of the type of comments you expected when you wrote your articles. This article shows you how to remove the Website field from comments. If you want to stop the spam comments, you may want to read the previous article we wrote about how to stop spam comments in WordPress.

This page may contain affiliate links, which help support our project. Read our affiliate disclosure.
Hendri Risman

Hendri Risman

Hendri is a WordPress expert and a writer staff at WPPagebuilders. He writes solutions on how to get things fixed in WordPress a lot. Mostly without involving a plugin.
Want to save yearly expense up to $219? why not?

5 thoughts on “How to Remove Website Field from Comment Form in WordPress”

    • Hi Saman,
      To remove the email field, you can just add one more filter to your theme functions.php file.
      Here is code for it

      add_filter(‘comment_form_default_fields’, ’email_remove’);
      function email_remove($fields)
      {
      if(isset($fields[’email’]))
      unset($fields[’email’]);
      return $fields;
      }

      Reply
    • Hi Jeremy,
      Thank you for your suggestion! we really appreciate your willingness to help and provide an alternative solution.

      Reply
  1. Thanks, it works. The fields removed.
    But, unfortunately it is still not sending message, cause of an error – *Error: Please fill the required fields.*

    Reply

Leave a Comment