Remove the Website Field From the Comment Form

Teli Adlam —  May 9, 2007

One of my clients came to me with a problem: people would leave comments and those who didn’t have a website would type n/a, none, or some other random word in the website field when leaving a comment. It seems they didn’t realize they could leave it blank if they didn’t have a website or blog to link to.

This was a relatively simple problem to fix with only one small tweak to the comments.php and comments-popup.php template files. Delete the website input field from the form. In the end, it didn’t hurt the number of comments left; however, it did cut down on the number of comments with random text for websites.

I’m sure you’re wondering what those people who do have a website are to do. Well, those people generally figured out they can place the link in the actual comment body or that they can register for an account on the blog (if registration is allowed) and add the link in their profile.

The How-To:
In your theme folder, locate the comments.php and comments-popup.php template files. The example below will assume you’re using the default (Kubrick) theme.

Make sure to back up your files before editing, then find the following and delete it (or comment it out):

<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small>Website</small></label></p>

(To comment out a block of code, add <!-- before it and --> after it.)

This may not be the ideal solution for every blog, but it’s a healthy solution for blogs that get a lot of non-blog-savvy readers. An alternative would be to add a note before the website field asking readers without a website to leave the field blank. (By the way, I’ve tried the alternative with marginal success. Some people simply don’t read, comprehend, or follow instructions well.)

Teli Adlam

Posts

10 responses to Remove the Website Field From the Comment Form

  1. I would prefer some logic in the code to look at the characters in the field, then varify that they contain one of the valid endings to a domain name. For examlple, it must contain .com, .net, .org, ..ect.

    A list of valid domain suffix can be found at http://www.norid.no/domenenavnbaser/domreg.html

  2. Hi Eric,
    In general, I agree with you. However, to accomplish the checks necessary would require far more tweaking and coding (which could possibly involve modifying core files) than the simple fix of removing the URL option and in some cases it would be overkill, plus it wouldn’t account for the people who put in random URLs (e.g. google.com, msn.com, aol.com, & so forth).

    Removing the URL field isn’t a new idea; certain publications that don’t warrant a majority of their users leaving a link will remove the option, for instance The New York Times blogs, without adversely impacting the interaction of their readership.

    For the blogs that don’t need to worry about such a problem, URL checking/field removal isn’t necessary. Using this one as an example, I leave it intact because a majority of the commenters will understand that it’s optional and it’s extremely rare that I receive a gibberish URL (that isn’t attached to a spam comment). :)

    ~ Teli

  3. wordpress php freak November 13, 2007 at 8:46 am

    I think leaving a website is not a bad option to have. It encourages people specially who have blog to pass sometime valuable comments about your site.

  4. You can leave “Website” field, but just check if it contains “http://” or not. It’s a more correct way, I think.

  5. Better to have there a website name as default! So if we commenters want to change it, we can, otherwise, we will leave it unchanged!

  6. I like it, a very simple fix. Of course, we could regex it or something similar, but if you just want to hide the field, this works great!

  7. actually i’ve commented out the email and website fields. the result is an error message that says

    Error: please fill the required fields (name, email).

    now what?

  8. A neat solution for the problem that was bugging me for some time. I run the website of a professional organization and many members have asked me what to write in the Website field. I used to tell them to leave it blank.

    I was thinking of adding (optional, you may leave it blank) next to Website. As my members don’t have their own websites, removing the field is ideal for me.

    Thanks.

  9. I wonder if removing the URL field would reduce the amount of comment spam. It would certainly manual spamming but how about those scripts they are using.

  10. Kaifu Computing June 16, 2010 at 6:42 am

    I agree with Yuki, checking to see if either http:// or https:// exists in the website field is a neater solution.

    However entirely removing the field is a perfectly valid way to fix the problem, and as you say, websites with readership who are not tech savvy will more often than not leave the field blank anyway.