Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Remove the Website (URL) Field from the WordPress Comment Box

Spammers love the "Website" box in comment forms. This guide shows how to remove it.

WordPress2 min read14 steps

Why remove the URL field?

A comment form usually asks for a name, an email and a website. The website box is called the URL field. A URL is a web address. Spammers fill it with links to their own pages. If you remove the box, you get less spam.

You can do this with a small piece of code. The code goes in a file called functions.php. This file belongs to your theme. A theme controls how your site looks.

Warning: A mistake in functions.php can break your site. Take a backup first. Use a child theme if you have one, so updates do not erase your change.

Method 1: Add code

  1. Log in to your WordPress dashboard.
  2. Go to Appearance, then Theme File Editor. In some versions it is under Tools.
  3. On the right, click functions.php.
  4. Scroll to the very bottom of the file.
  5. Paste this code:
function remove_comment_url_field( $fields ) {
    unset( $fields['url'] );
    return $fields;
}
add_filter( 'comment_form_default_fields', 'remove_comment_url_field' );

This code takes the "url" box out of the list of comment fields.

  1. Click Update File.
  2. Open any post on your site and look at the comment form. The Website box should be gone.

If the editor is switched off, use File Manager in your hosting control panel. Open wp-content/themes, then your theme folder, and edit functions.php there.

Method 2: Use a plugin

A plugin is an add-on for WordPress. If you prefer no code, a code snippets plugin lets you paste the same code safely.

  1. Go to Plugins, then Add New Plugin.
  2. Search for a code snippets plugin.
  3. Click Install Now, then Activate.
  4. Add a new snippet, paste the code above, and save it as active.

Snippets stay in place even if you change your theme.

If your site breaks

  1. Open File Manager in your control panel.
  2. Edit functions.php and remove the code you added.
  3. Save the file.
Tip: Existing comments keep any links they already have. Also turn on comment moderation under Settings, then Discussion, to approve comments before they appear. Need help? Open a ticket at https://secure.hostvento.com/submitticket.php.

Quick recap

  • The URL field invites spam links.
  • Add a small filter to functions.php, or use a snippets plugin.
  • Back up first, and use a child theme if possible.
  • Check a post to see the field is gone.