DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

In some cases, you may not need or want that people who comment your posts can leave their website url. Here is a simple code snippet to remove the url field from WordPress comment form.

Paste the code below into your functions.php file. Once saved, the url field will be removed from your comment form.

function remove_comment_fields($fields) {
    return $fields;

Thanks to WP Tuts for the tip!


  1. I have seen Smashing Magazine’ Comment Form, URL field doesn’t show up, I added the code and its working fine.

  2. A big thanks for this code, really need this one.

  3. It’s really help alot but why not used nofollow in the hyperlink instead remove the url?

  4. Additional methods:
    – you can just comment out the PHP line
    – you can add a class or ID on that line and then hide it from CSS.

    • @ Vic: If you comment it out, you’ll need to reapply the change to /wp-includes/comment-template.php after each WordPress update. That is assuming that’s where you meant commenting the line out. If you apply the supplied recipe to your Functions plugin or custom theme’s functions.php file, you won’t have to reapply it after every WP update.

      If you just use CSS to hide it or a HTML comment tag, those of us using web development tools like Firebug can easily show it again.
      @ Aryocosmo: Not every site owner desires allowing people to post their URLs, not just for anti-spam purposes. Additionally, many spammers don’t care about not getting link juice. Posting the link just hoping someone clicks through is good enough. Omitting the website field completely helps fight SPAM.
      @ the article: I love this recipe! I’m a strong believer that the comment you leave should stand alone. If you wouldn’t make such a comment without randomly including your website, you shouldn’t bother making a comment. It’s probably pretty vague or pointless anyway. Including your URL to those sites that allow it is just a bonus. It shouldn’t be why you’re posting a comment, unless doing so is directly related to the article at hand.

      The benefit of this recipe is that it actually does allow the commentator to include their URL, but specifically blocks Guests. Those logged into their website account can include a URL within their profile, and it will be included with the comment just the same as Guests formally could.

  5. Gracias, thanks for this usefull code.

  6. Incredibly useful little code snippet. I have got several sites on the web which get spammed frequently so I am gonna get rid of the url box on a couple of them.

Leave a Comment

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