# Remove the website field from the WordPress comment form

URL: https://wp24x7.com/remove-website-field-from-comment-form-to-reduce-spam/
Updated: 2026-11-29
Type: blog post
Audience: WordPress site owners with open comments

> A how-to for removing the Website field from the WordPress comment form with the comment_form_default_fields filter, which reduces link spam. It adds a second filter to discard URLs on save, lists the Discussion settings that matter more, explains when an anti-spam plugin is still needed and how to check the change worked.

## Key facts

- For: WordPress site owners with open comments
- Form change: unset the url key in comment_form_default_fields
- Server-side change: clear comment_author_url in preprocess_comment
- Better controls: Settings, Discussion moderation rules
- Not a cure: bots still post text, so add layered protection
- Where to put code: a small plugin or child theme, after a backup

The Website field on a comment form is a gift to link spammers, who post a bland comment so their URL appears on your site. **Remove the field with the `comment_form_default_fields` filter, and pair it with moderation settings.**

> **Quick answer**
Add the `unset( $fields['url'] )` filter below in a small plugin or child theme, then hold comments that contain links under Settings, Discussion. The filter cuts some link spam but does not stop bots posting text.

## Why does the field attract spam?

Many commenters leave it empty, but spam bots fill every field they find. When a comment is approved, the author's name links to that URL, which is what the spammer wants. Without the field, they have less reason to post, and you have fewer links to review. WordPress also marks author links with `rel="ugc nofollow"` by default, so they pass little search value, but bots do not know that and do not stop.

## What is the code to remove it?

Add this to a site plugin or a child theme's `functions.php`, after a backup:

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

The `url` key is the Website field. The same array holds `author` (name), `email` and `cookies` (the "save my details" checkbox). Remove only what you want to lose. A form that asks for fewer things also tends to get more genuine comments.

Block themes use the Post Comments Form block, which calls `comment_form()` under the hood, so the same filter applies. Check the page afterwards, as a theme or plugin that replaces the comment form may skip it.

## What about bots that skip the form?

The filter only changes the form shown to visitors. Comments submitted another way, such as through the REST API by a logged-in user, are unaffected. If you want to discard a URL from any submitted comment, filter it on save:

```php
add_filter( 'preprocess_comment', function ( $commentdata ) {
	$commentdata['comment_author_url'] = '';
	return $commentdata;
} );
```

That also blocks bots that post straight to `wp-comments-post.php` with a URL in the request, which a form-only change would not stop. Keep both changes if spam is a real problem.

| Change | Stops | Does not stop |
|:--|:--|:--|
| `comment_form_default_fields` | The field appearing to visitors | Bots posting directly with a URL |
| `preprocess_comment` | Any URL being saved with a comment | Link spam written inside the comment text |
| Moderation settings | Links and risky comments going live | Spam sitting in the queue |

_Filtering spam before it reaches the comment queue_

## Which settings help more?

Go to **Settings, Discussion** and review:

| Setting | Effect | Trade-off |
|:--|:--|:--|
| Comment author must fill out name and email | Slows casual bots | Few |
| Users must be registered and logged in to comment | Removes most spam | Fewer comments |
| Automatically close comments on older posts | Old posts attract much spam | Stops genuine comments on useful older articles |
| Comment must be manually approved, or author must have a previously approved comment | Nothing unseen goes live | More moderation work |
| Hold a comment if it contains N or more links (set to 1 or 2) | Catches link spam | Occasional genuine link held |
| Comment Moderation and Disallowed Comment Keys lists | Hold or reject by word or address | Needs upkeep |

## Do I still need an anti-spam plugin?

Often, yes, for any site with open comments. Akismet, made by Automattic, is the best-known option, and there are free alternatives that use a hidden field (a honeypot) or a challenge. Whichever you use, remember that plugins can fail silently when an API key expires or a service is down, so check the spam folder occasionally.

Some comment spam is also trackbacks and pingbacks. If you do not use them, turn off **Allow link notifications from other blogs (pingbacks and trackbacks)** in the Discussion settings.

## What if I want no comments at all?

Many business sites do not need them. Turn comments off by default for new posts in Discussion settings, and use the Quick Edit bulk action to close them on existing posts. Some themes still show the "comments are closed" notice, and your theme or a plugin can hide it. An all-out disable removes the whole spam surface, including the comment feeds.

## Worked example: a small blog with link spam

For example, a small blog gets a dozen comments a day, nearly all of them one-line praise with a link to an unrelated product site. The owner removes the Website field, holds any comment with one or more links for approval, and closes comments on posts older than a few months. Within a week the queue is mostly empty. The few genuine comments still arrive, and the owner still checks the spam folder once a week in case a real reader was caught.

## What if I want to keep the field but reduce the abuse?

Keep it, and combine these steps: hold comments with links, require a previously approved comment, add a honeypot or an anti-spam service, and make author links `nofollow` (WordPress already adds `ugc nofollow`). The field then stays useful for genuine commenters who want to link to their own site.

## How do I check that it worked?

1. **Look at the form.** Open a post in a private window.
2. **Submit a test comment.** Check it lands in moderation as expected.
3. **Clean old comments.** On the Comments screen, edit any approved comment that still links to a spam URL.
4. **Watch for a week.** Fewer link-stuffed comments in the spam folder is the signal.

## Common mistakes

> **Avoid these**
Putting the code in a theme's `functions.php`, then losing it when the theme is changed. Removing the field and forgetting to tidy URLs on old comments. Relying on one control, when spam arrives through forms, trackbacks and the REST API. Never looking at the comment queue, so genuine questions go unanswered.

- **WordPress support** Layered protection for comments, forms and registrations. [WordPress support](/wordpress-support)
- **Security service** Hardening and monitoring against bots. [Security service](/wordpress-security-service)
- **Anti-spam plugins** A free option compared in detail. [Best free anti-spam plugin](/the-best-free-anti-spam-plugin-to-protect-your-website-against-comment-spam-in-2023)

**Overrun by spam bots?**
An engineer can set up layered protection.
[Post a project](/post-project)
[Call the help desk](/help-desk)

## Frequently asked questions

### Will removing the website field stop all comment spam?

No. It removes the incentive for link spam and cuts some of it, but bots still post text. Use moderation settings and an anti-spam service too.

### Does the filter hide the field in the comment editor?

It removes the field from the public form. Existing comments keep any URL they already have.

### My theme builds its own comment form. Will this work?

It works if the theme uses comment_form(), which is almost all of them. A page builder's custom comment widget may ignore the filter, so check the page.

### Does this work with block themes?

Yes, because the Post Comments Form block calls comment_form() under the hood. Check the page afterwards, since a theme or plugin that replaces the comment form may skip the filter.

### Why do spam bots want the website field?

When a comment is approved, the author's name links to the submitted URL, which is what the spammer wants. Bots fill every field they find, so removing it takes away the reward.

### Do author links pass search value?

WordPress marks author links with rel ugc nofollow by default, so they pass little search value. Bots do not know that, so they keep posting.

### Can bots still send a URL if the field is gone?

Yes, by posting straight to wp-comments-post.php. Clearing comment_author_url in the preprocess_comment filter discards it on save, so keep both changes if spam is a real problem.

### Which Discussion settings help most?

Hold comments with one or two links, require a previously approved comment, require name and email, close comments on old posts, and add words to the moderation and disallowed lists.

### Do I still need an anti-spam plugin?

Often, yes, on any site with open comments. Akismet is the best-known option and free alternatives use honeypots or challenges. Check the spam folder occasionally, because plugins can fail silently when a key expires.

### How do I turn comments off entirely?

Turn them off by default for new posts under Settings, Discussion, and use the Quick Edit bulk action to close comments on existing posts. This removes the whole spam surface, including comment feeds.

### Should I turn off pingbacks and trackbacks?

If you do not use them, yes. Untick the option that allows link notifications from other blogs in the Discussion settings, since some comment spam arrives as trackbacks.

### How do I check the change worked?

Open a post in a private window and look at the form, submit a test comment and check it lands in moderation, edit any approved comment that still links to a spam URL, then watch the spam folder for a week.
