WordPress comment-form guide

How to remove the URL field from the WordPress comment form

Remove the optional Website field with WordPress’s comment-field filter, place the code somewhere update-safe, and verify that custom themes and plugins still behave correctly.

The default WordPress comment form can include Name, Email, Website, and Comment fields. The Website field is optional and can be removed from the generated form by filtering the default field array and unsetting its url entry.

Default form

Name
Email
Website
Comment

Modified form

Name
Email
Website field removed
Comment

Choose where the code belongs

Recommended for site behavior

Small site plugin

Use this when the field should remain removed even after the active theme changes.

Theme-specific behavior

Child theme

Use the child theme’s functions.php when the change is intentionally tied to that theme.

Avoid

Parent theme or WordPress core

Updates can overwrite the change, and core edits create an unsafe maintenance path.

Location Survives parent-theme updates Survives theme switching
Small site plugin Yes Yes
Child-theme functions.php Yes No
Parent-theme functions.php No No

Use the updated filter snippet

This preserves the original approach while giving the callback a project-specific prefix:

<?php
/**
 * Remove the Website field from the default comment form.
 *
 * @param array $fields Default comment form fields.
 * @return array
 */
function tdwp_remove_comment_url_field( $fields ) {
    unset( $fields['url'] );

    return $fields;
}
add_filter(
    'comment_form_default_fields',
    'tdwp_remove_comment_url_field'
);

The filter receives the default fields as an array. Removing the url key prevents WordPress’s standard comment_form() output from rendering that field.

Method 1: Add it to a child theme

Back up and use staging

Do not begin with the live production file as the only copy. Keep a rollback path through hosting access or version control.

Confirm the child theme is active

Open Appearance > Themes. The snippet should not be placed in the parent theme if it needs to survive parent updates.

Edit the child functions.php

Add the callback outside any other function. Do not add a second opening <?php tag when the file already begins with one.

Save and test

Open a post with comments enabled while logged out. Confirm that Name, Email, and Comment remain and Website is absent.

Method 2: Create a small site plugin

For behavior that should remain independent of the theme, create a plugin file such as tdwp-comment-form.php:

<?php
/**
 * Plugin Name: TDWP Comment Form Cleanup
 * Description: Removes the Website field from the default WordPress comment form.
 * Version: 1.0.0
 */

defined( 'ABSPATH' ) || exit;

function tdwp_remove_comment_url_field( $fields ) {
    unset( $fields['url'] );

    return $fields;
}
add_filter(
    'comment_form_default_fields',
    'tdwp_remove_comment_url_field'
);

Place the file in its own folder under wp-content/plugins, then activate it through Plugins > Installed Plugins. Use a unique function prefix to avoid collisions with themes or other plugins.

Preserved original 2014 snippet

The original code remains functionally recognizable. It used theme_slug_remove_comment_fields(), removed $fields['url'], returned the array, and registered the callback on comment_form_default_fields. The revised version changes the prefix and adds safer placement and testing guidance.
<?php
function theme_slug_remove_comment_fields( $fields ) {
    unset( $fields['url'] );

    return $fields;
}
add_filter(
    'comment_form_default_fields',
    'theme_slug_remove_comment_fields'
);

What the filter changes

  • It removes the Website field from forms generated through WordPress’s default comment-form field system.
  • It does not delete website URLs stored with older comments.
  • It does not remove the author link shown beside previously submitted comments.
  • It does not disable comments or remove the comment textarea.
  • It may not affect a plugin or theme that builds a completely custom form without using the default field filter.

Existing comment-author URLs

Removing the input field prevents future visitors from entering a website through that standard form. Existing comment records can still contain author URLs, and a theme may continue linking older author names to those stored destinations.

Do not bulk-delete stored URLs without a backup and a clear data-retention reason. Removing an input from the form and altering historical database records are separate operations.

Block themes and the Post Comments Form block

Block themes can place a Post Comments Form block in a template, but the public form is still generated through WordPress comment-form APIs when the block uses the standard implementation. The filter can therefore remain effective without editing the block template.

If the Website field remains, test with a current default theme in staging and inspect whether a plugin or custom block replaces the standard form.

Will removing the field stop comment spam?

Removing the Website field can reduce one incentive for low-effort link submissions, but it is not a complete anti-spam system. Automated comments can target the endpoint directly, place URLs inside the comment body, or submit through another integration.

  • Use comment moderation and trusted anti-spam controls.
  • Keep WordPress, themes, and plugins updated.
  • Review suspicious links before approval.
  • Rate-limit or protect abusive traffic at the application or hosting layer when necessary.
  • Do not rely on visually hiding the field with CSS; the field and submission value would still exist.

Accessibility and form clarity

After removing the field, confirm that labels remain correctly associated with Name, Email, and Comment. Check that required-field instructions still match the visible form and that focus order moves logically from one control to the next.

Test the change

Logged-out form

Anonymous users may see different fields from signed-in users, so test in a private browser window.

Required fields

Name, Email, Comment, privacy consent, and plugin-added fields should still work as intended.

Theme templates

Check posts, pages, custom post types, and block templates that display comments.

Submission

Submit a test comment and verify validation, moderation, notifications, and success or error messages.

Responsive layout

Ensure the removed row does not leave broken spacing or an empty wrapper at mobile widths.

Plugin conflicts

Review social-comment, membership, ecommerce, anti-spam, and custom-form integrations.

Troubleshooting

The Website field still appears

Clear page caches and test while logged out. Confirm the code is active, the callback name is unique, and the form uses WordPress’s default field filter.

The site shows a PHP error

Restore the previous file through hosting access or version control. Check for a missing semicolon, unmatched brace, duplicated function name, or code placed inside another function.

The field disappeared only on some posts

Those content types may use different templates, comment plugins, or review forms. Inspect each public form rather than assuming one implementation covers the entire site.

A theme update restored the field

The snippet was probably placed in the parent theme or the active theme changed. Move the behavior into a child theme or small site plugin.

The author name still links to a website

That link comes from data stored with an existing comment. The form filter stops rendering the future input; it does not rewrite older comment records or theme output.

Restore the URL field

Remove the filter and callback from the child theme or deactivate the small plugin. Clear relevant caches and recheck the public form while logged out. The default field should return unless another customization removes it.

Official WordPress references

Article status

Archived discussion

The original page contained inactive comment and newsletter forms. They were removed so visitors are not asked to submit personal information to obsolete endpoints.