Remove the website field from the WordPress comment form
Remove the comment form's URL field with one filter, why it cuts some spam, and the settings that matter more for keeping comments clean.
At a glance
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.
Updated November 29, 2026 · For WordPress site owners with open comments
- 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
On this page
- Why does the field attract spam?
- What is the code to remove it?
- What about bots that skip the form?
- Which settings help more?
- Do I still need an anti-spam plugin?
- What if I want no comments at all?
- Worked example: a small blog with link spam
- What if I want to keep the field but reduce the abuse?
- How do I check that it worked?
- Common mistakes
- FAQ
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.
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:
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:
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 |
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?
- Look at the form
Open a post in a private window.
- Submit a test comment
Check it lands in moderation as expected.
- Clean old comments
On the Comments screen, edit any approved comment that still links to a spam URL.
- Watch for a week
Fewer link-stuffed comments in the spam folder is the signal.
Common mistakes
Layered protection for comments, forms and registrations.
WordPress support02Security serviceHardening and monitoring against bots.
Security service03Anti-spam pluginsA free option compared in detail.
Best free anti-spam pluginAn engineer can set up layered protection.
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.
Link to this answerDoes 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.
Link to this answerMy 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.
Link to this answerDoes 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.
Link to this answerWhy 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.
Link to this answerCan 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.
Link to this answerWhich 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.
Link to this answerDo 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.
Link to this answerHow 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.
Link to this answerShould 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.
Link to this answerHow 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.
Link to this answerKeep reading
Want an engineer on it?
Tell us what is wrong in plain words. A person reads it, today.