WordPress functions.php code snippet to modify the Read More link

How to Remove the URL Field From WordPress Comments

Last modified: October 22, 2026

Fiverr freelancers

Removing the Website (URL) field from your WordPress comment form takes about 30 seconds and cuts off the main reason spambots bother with your comment section in the first place. This guide covers two methods — a PHP snippet and a free plugin — plus what to do if you use a Block Theme, how to confirm it worked, and answers to the questions site owners ask most after making the change.

If you want the short version: add the filter below to your theme’s functions.php and the field disappears immediately. If you’d rather not touch PHP, the plugin method is just as reliable and reversible from the admin panel.

Can You Make the URL Field Optional Instead of Removing It?

WordPress’s default comment form already marks the URL field as optional — there is no required attribute in the HTML. So if your goal is simply “don’t force commenters to provide a URL,” nothing needs to change.

The question is whether you want to keep the field visible at all. Here’s how to decide:

  • Remove it entirely if your main concern is comment spam. Spambots target the URL field specifically for link placement. Removing the input removes the incentive.
  • Keep it but restrict logged-in users only if you run a membership site or community where registered users should be able to link to their own sites. Wrap the PHP snippet in a if (!is_user_logged_in()) check, and the field only shows for users who are signed in.
  • Keep it unchanged if your comments are heavily moderated by real people and you find the URL field genuinely useful for evaluating who’s commenting.

Optional fields are still submitted by bots. If spam is the problem, making the field optional does not solve it — only removing the input entirely eliminates that attack vector.

Checking Your Theme’s Comment Filter Compatibility

The PHP snippet in Method 1 hooks into the comment_form_default_fields filter. Most classic themes process this filter correctly, but it’s worth checking before you add the snippet.

How to check: Open a post on your site that has commenting enabled, right-click the comment form, and choose Inspect Element. Search the HTML for name="url". If you find an input with that attribute, the filter approach will work when you add it.

If the snippet doesn’t remove the field: Some themes bypass the default fields filter and render the comment form through a custom template. In that case, try the comment_form_fields fallback filter from Method 1 — it fires later in the rendering pipeline and catches what the first filter misses. If that still doesn’t work, your theme likely outputs the comment form through fully custom markup, and the Site Editor method (for Block Themes) or a direct theme file edit is the right path.

If you’re on a Block Theme (Twenty Twenty-Four, Twenty Twenty-Five, Kadence Block Theme, and similar): the PHP filter typically works, but if it doesn’t, go to Appearance > Editor, find the Comments template part, and delete the Website field block directly in the Site Editor. That overrides any code the theme might be using.

Third-party comment systems: If you use Disqus, Jetpack Comments, or a similar replacement, those plugins control their own comment form entirely. The PHP filter has no effect on them. You’d need to check the settings panel for that specific plugin.

Common Questions About Removing the WordPress Comment URL Field

Will removing the URL field break anything on my site?

No. The field is entirely optional to begin with, and WordPress does not rely on it for any core functionality. Comments submitted after the change simply have an empty URL field in the database, which is the same as comments where the commenter left it blank. Nothing breaks on the front end or in your comment moderation queue.

What happens to existing comments that already have URLs stored?

They stay exactly as they are. Removing the field stops new URL data from being collected — it doesn’t touch the database records for comments that were already submitted. If you want to clear out spam URLs that are already stored, you can do that through phpMyAdmin or WP-CLI. The full cleanup commands are in Method 1 of this guide under “Verifying the Change.”

Does this affect WooCommerce product reviews?

The PHP method (using comment_form_default_fields) also removes the URL field from WooCommerce product review forms, since WooCommerce uses the same WordPress comment system. If you want to remove the field from regular blog comments but keep it on product reviews, use the plugin method (Comment Form Fields Editor), which gives you per-form-type control.

What if I use Disqus or Jetpack Comments?

Third-party comment systems replace the WordPress comment form entirely with their own. The PHP snippet has no effect on them. Check the settings for whichever plugin you’re using — Disqus, for example, doesn’t include a URL field by default; Jetpack Comments includes one in its “Enhanced Comments” form that you can disable in Jetpack settings.

Does this stop all comment spam?

It stops the category of spam that targets your site specifically for link placement via the URL field. That’s often the majority of comment spam volume on content sites. It won’t stop keyword-stuffed spam submitted through the comment body, for which Akismet or a similar filter is the right tool. See our guide on WordPress antispam plugins for a broader approach.

Show More

* This button will show the rest of the post and open up an offer from a vendor

Why the URL Field Attracts Comment Spam

WordPress’s default comment form includes three fields: Name, Email, and Website (URL). The URL field was originally intended to let commenters link to their own blog, a convention from the early days of WordPress when blog networks were common.

Today it is a spam magnet for a specific reason: link equity. A link from a real, indexed website passes a small amount of PageRank to the destination. Spambots are not leaving comments to express an opinion — they are placing links at scale across thousands of sites to improve their target domain’s authority in search results. The URL field is the easiest way to do this because it creates a published link without requiring the comment body to contain anything useful or get past spam filters.

Removing the URL field has two effects:

  • It eliminates the primary incentive to submit spam comments. Bots targeting the URL field stop submitting once there is nothing to submit to.
  • It reduces your moderation workload, since fewer spam comments are submitted in the first place rather than just caught after submission.

The trade-off is minor: genuine commenters who want to share their site can no longer do so via the comment form. In practice, most readers on content-focused sites do not use the URL field anyway. And those who do can always include a link in the comment body, where it will be moderated alongside the comment text.

WooCommerce note: If your site runs WooCommerce, product reviews use a separate comment template. The PHP method below also removes the URL field from WooCommerce product reviews. If you want to remove it from blog comments only and keep it on product reviews, use the plugin method, which gives you more granular control per form type.

Method 1: Remove the URL Field With PHP

The quickest way is to add a small function to your theme’s functions.php file. This method requires no plugin and the change takes effect immediately:

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

Add this to your functions.php file and the URL field will be removed from all WordPress comment forms on your site. The function hooks into the comment_form_default_fields filter and unsets the url key from the fields array before WordPress renders the form.

If the above filter does not work (some themes call a different hook), try the comment_form_fields filter instead — it fires later in the rendering pipeline and catches cases the default fields filter misses:

function scanwp_disable_comment_url_late($fields) {
    unset($fields['url']);
    return $fields;
}
add_filter('comment_form_fields', 'scanwp_disable_comment_url_late');

Use only one of these two functions, not both. The second filter is the fallback if the first does not remove the field.

A few notes:

  • This only affects the default WordPress comment form. If you are using a third-party comment plugin (Disqus, Jetpack Comments, etc.), the plugin controls its own form fields.
  • Existing comments that already have a URL stored are unaffected. The URL data remains in the database; it just will not be collected from new comments.
  • If you are using a child theme, add the function to the child theme’s functions.php to avoid losing it on theme updates.
  • On multisite networks: this function only affects the site whose functions.php you edited. To apply it across all sites in a network, add it to a must-use plugin (mu-plugins folder) so it loads for every site automatically.

If you are not comfortable editing PHP files directly, see Method 2 for a plugin alternative. You can also read about WordPress antispam plugins for a broader approach to comment spam reduction.

Method 2: Use a Plugin Instead

If you would rather not edit PHP files, a plugin like Comment Form Fields Editor (free on the official WordPress plugin repository) lets you control which fields appear in the comment form from the WordPress admin without any code.

To use it:

  1. Install and activate Comment Form Fields Editor from Plugins > Add New.
  2. Go to Settings > Comment Form Fields.
  3. Locate the Website (URL) field and uncheck it or toggle it off.
  4. Save. The field is immediately removed from your comment form.

This approach is fully reversible. You can turn the field back on at any time from the same settings screen. It is the better choice if you are managing a site for a client who may want to re-enable the field later without needing a developer.

Zero-plugin option if you have Yoast SEO: Yoast SEO includes a built-in toggle to disable comment URLs. Go to Yoast SEO > Site Settings > Site Features, scroll to the Comments section, and look for the “Comment author URLs” toggle. Switching this off removes the URL field sitewide without installing anything extra. This is the fastest path if Yoast is already active on your site.

Other plugins that include comment form field control:

  • Jetpack: Replaces the comment form entirely with its own system. The URL field behavior depends on Jetpack’s own settings, not WordPress defaults.
  • Security plugins (Wordfence, iThemes Security): Some include comment spam options, but few offer field-level control. These are better suited to blocking spam submissions after the fact rather than removing the URL field specifically.

For most sites, either the PHP snippet or Comment Form Fields Editor is the right tool. The PHP approach is permanent and requires no plugin management; the plugin approach is better when you want a toggle you can control from the admin panel.

Block Themes and Full Site Editor: What Changes

If your site uses a Block Theme (introduced in WordPress 5.9) and the Full Site Editor rather than a Classic Theme, the standard PHP snippet still works for the comment form, but there is an important difference to be aware of.

Why this matters for Block Themes:

Block Themes render the comment form through a block-based template, typically the comments.html template part in your theme’s /templates/parts/ folder. The comment_form_default_fields filter still fires and still removes the URL field from the PHP-rendered output. However, some newer Block Themes override the comment block with a custom block implementation that may not go through the standard filter at all.

How to check whether the PHP snippet is working in your Block Theme:

  1. Add the PHP snippet to your active theme’s functions.php or a site-specific plugin.
  2. Navigate to any post on your site that has commenting enabled.
  3. Scroll to the comment form. If the Website field is gone, the snippet worked.
  4. If the field is still showing, your theme is using a custom block for comments. In that case, proceed to the Site Editor steps below.

Removing the URL field directly in the Site Editor:

  1. Go to Appearance > Editor in your WordPress admin to open the Full Site Editor.
  2. In the left navigation, click Patterns, then find the Comments template part (it may also be listed under Templates).
  3. Click into the Comments template part to edit it.
  4. Click on the comment form area. You should be able to select a Comment Form block or a Post Comments Form block.
  5. Inside that block, look for an Author URL field block or a block labeled “Website.” Click it to select it.
  6. Press Delete or use the block’s three-dot menu and choose Remove block.
  7. Click Save to apply the change to the template.

For themes like Twenty Twenty-Four, Twenty Twenty-Five, or Kadence’s block theme, the PHP snippet approach works without issue. You only need the Site Editor route if the PHP snippet leaves the field visible after adding it.

Plugin alternative for Block Themes:

The plugin approach (Comment Form Fields Editor) typically works with Block Themes because it hooks into the same filter. But if the theme bypasses standard WordPress filters entirely, the plugin will not work either. In that situation, editing the block template directly in the Site Editor is the most reliable fix.

Verifying the Change and Checking Your Spam Queue

After making the change with either method, do a quick verification before considering the task done.

Verify the URL field is removed:

  1. Open your site in a private/incognito browser window. This ensures you are not seeing a cached version of the form.
  2. Navigate to any published post with comments enabled.
  3. Scroll to the comment form. The Website field should be absent. The form should show only Name, Email, and the comment text area.
  4. Right-click the comment form and choose Inspect Element. Search the form’s HTML for id="url" or name="url". If those attributes are gone, the field has been removed at the HTML level, not just hidden with CSS.

What to expect from your spam queue afterward:

Most sites see a drop in spam comment submissions within 24 to 72 hours. The reduction is not always immediate because some spam networks cache target URLs and keep submitting for a short period even after the field disappears. After about a week, the volume typically drops to near zero for the lowest-effort bot traffic.

Akismet and similar tools still catch the small amount of keyword-stuffed spam submitted through the comment body. Removing the URL field does not eliminate all spam, but it removes the category that was specifically targeting your site for link building.

Cleaning up existing comments that have spam URLs:

The removal methods above stop collecting new URL data, but they do not touch URLs already stored in your database. If you want to clean those up:

Using phpMyAdmin:

  1. Log into phpMyAdmin via your hosting control panel.
  2. Select your WordPress database.
  3. Click SQL and run: SELECT comment_ID, comment_author, comment_author_url FROM wp_comments WHERE comment_author_url != '' LIMIT 100;
  4. Review the results. To clear a specific URL: UPDATE wp_comments SET comment_author_url = '' WHERE comment_ID = [ID];
  5. To clear all stored URLs in one pass (use only if you are certain you want this): UPDATE wp_comments SET comment_author_url = '' WHERE comment_author_url != '';

Using WP-CLI (faster for large sites):

wp comment list --fields=ID,comment_author_url --format=csv | grep -v "^ID" | grep -v ",,$"
# Then to clear all:
wp db query "UPDATE wp_comments SET comment_author_url = '' WHERE comment_author_url != ''"

Database cleanup is optional. It only matters if you have a large number of approved comments with spam URLs that are still pointing to low-quality sites. For most sites, simply removing the field going forward is sufficient.

Final Word: Remove the URL Field From WordPress Comments

If you are comfortable with PHP, the functions.php snippet is the cleaner option: no extra plugin, no database entries, done in a minute. If the default filter does not work with your theme, the comment_form_fields fallback usually catches it. If you are managing someone else’s site or want a toggle from the admin panel, Comment Form Fields Editor is the right fit. And if you already have Yoast SEO installed, check its Site Features first — it may already have the option you need.

If your site runs a Block Theme and the PHP snippet does not take effect, go directly to Appearance > Editor, find the Comments template part, and delete the Website field block from the Site Editor. This works for any Block Theme where the PHP filter is bypassed.

On multisite networks: the functions.php approach only applies to the individual site where you add the code. To remove the URL field across all sites in a WordPress multisite network, place the function in a must-use plugin file (for example wp-content/mu-plugins/disable-comment-url.php). Must-use plugins load for every site in the network automatically.

After making the change, verify it with a private browser window, not just your logged-in admin view. Check your spam queue over the following week. Most sites see a noticeable drop in bot-submitted comments within a few days, since the URL field is the main target for link-building spambots rather than the comment text itself. For a broader approach to keeping your comment section clean, read our guide on WordPress antispam plugins.

Save 4 Later
Email liked links to yourself

    Stay Updated with WordPress Insights

    Get the latest WordPress tips, theme reviews, and industry deals delivered to your inbox.