How to Allow Users to Post Anonymous Comments on WordPress
Do you want to allow users to post anonymous comments on WordPress? Users cannot submit comments in WordPress without providing their name and email address in the comment form. However, not all visitors wish to make public their personal information.
In this article, we’ll teach you how to let people leave anonymous comments on your WordPress site. We’ll also teach you how to conceal the name and email fields in the WordPress comment form.
Can You Allow Anonymous Comments on WordPress?
Comments allow visitors to provide comments and ideas for improving your WordPress website. Blog readers can use comments to interact with other users. A busy comment area can foster a sense of community on your WordPress blog. Some individuals may even return to an article simply to read new comments, resulting in increased page views for your website. The issue is that WordPress does not allow users to submit comments without providing their name and email address, and some users are simply more privacy-sensitive. They may not always feel comfortable writing comments using their true identity.
In this instance, the best option is for customers to use anonymity or nicknames instead of their real names. This allows you to create a community while also allowing users to remain anonymous. Users will still be required to enter an email address, although most people who wish to leave anonymous comments use different emails for this purpose. You can communicate this by posting a comment policy directly above your comment box. However, you may want to provide additional privacy by either making the name and email fields optional or completely deleting them from your comment form.
Just be aware that allowing anonymous comments may make your site more open to comment spam. If you allow people to leave anonymous comments, you should use tools to counteract spam. For additional information, visit our article on how to moderate comments in WordPress. With that in mind, let’s look at how you can allow users to post anonymous comments in WordPress. If you want to get straight to a specific approach, use the links below.
- Method 1: Allow Users to Post Anonymously with Optional Names and Email Addresses.
- Method 2: Remove the Name and Email Boxes from the WordPress Comment Form.
Method 1: Allow Users to Post Anonymously with Optional Names and Email Addresses.
Before posting a comment, the usual WordPress comment form prompts users to enter their email address and name. These fields are required by default but can be made optional. Visitors who are comfortable providing personal information can still enter their name and email address.
To make the ‘Name’ and ‘Email’ fields on the comment form optional, click on Settings » Discussion in your WordPress dashboard.
Simply clear the box next to ‘Comment author must fill out name and email.’

Once you’ve completed that, simply scroll to the bottom of the page and click Save Changes. Visitors can now leave comments without entering their name and email address. However, the standard WordPress comment form still displays the mandatory fields ‘Name’ and ‘Email’, so visitors are aware that they can post anonymously.
With that in mind, you should add ‘Optional’ labels to the ‘Name’ and ‘Email’ fields. While you’re about it, consider deleting the website URL field from the WordPress comment form.
Many spammers and bots leave comments with the intention of posting a link to your website. Remove the website URL field from your WordPress comment form to discourage spam comments.
Adding the following code snippet to your website will add the ‘Optional’ labels and hide the website URL box.
You can include this code in your functions.php file, a site-specific plugin, or a code snippets plugin.
Then just save your modifications.
If you go to your site, you'll notice that the 'Name' and 'Email' fields are now designated as 'Optional.' You have also eliminated the website URL field from the WordPress comment form.function wpdruggy_alter_comment_form_fields($fields) {
// Modify Name Field and show that it's Optional
$fields['author'] = '<p class="comment-form-author">' . '<label for="author">' . __( 'Name (Optional)' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>';
// Modify Email Field and show that it's Optional
$fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Email (Optional)', 'twentythirteen' ) . '</label> ' .
( $req ? '<span class="required">*</span>' : '' ) .
'<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) .
'" size="30"' . $aria_req . ' /></p>';
// This line removes the website URL from comment form.
$fields['url'] = '';
return $fields;
}
add_filter('comment_form_default_fields', 'wpdruggy_alter_comment_form_fields');
Then just save your modifications. If you go to your site, you’ll notice that the ‘Name’ and ‘Email’ fields are now designated as ‘Optional.’ You have also eliminated the website URL field from the WordPress comment form.
Method 2: Remove the Name and Email Boxes from the WordPress Comment Form.
Another alternative is to fully delete the ‘Name’ and ‘Email’ boxes from the WordPress comment form. This makes it apparent that visitors may post anonymously. To accomplish this, add some code to your theme’s functions.php file. However, if you add this code straight to the functions.php file, you risk losing your custom code each time your WordPress theme is updated.
Instead, create a child theme and then add the code to it. This allows you to change your theme without losing the code you added to functions.php. To learn more, check out our comprehensive guide on how to create a WordPress child theme.
function wpdrugyy_alter_comment_form_fields($fields) {
unset($fields['author']);
unset($fields['email']);
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields', 'wpdruggy_alter_comment_form_fields');
When you visit your website, you will notice that visitors can no longer enter their email address or name.
Depending on your WordPress theme, your comment section could still display the following text: We will not publish your email address. Required fields are marked. This notice is confusing because visitors can no longer enter their email addresses. If you remove the ‘Name’ and ‘Email’ fields, you should also delete this message.
To remove the ‘Your email address will not be published’ line, open your theme’s comments.php file. You will now locate the following section:
<?php comment_form ?>
Then, simply replace this section with the code below:
<?php
comment_form(array(
'comment_notes_before' => '<p class="comment-notes">' . __( 'No name or email address required.' ) . ( $req ? $required_text : '' ) . '</p>'
));
?>
Your theme may not include a section, as each theme is unique.
If you can’t find this code, try opening your theme’s style.css file instead.
You can then add the following code snippet to remove the ‘Your email address will not be published’ text.
.comment-notes {
display:none;
}
The image below shows how your WordPress comment form looks without this message.
123
As shown in the image above, the WordPress comment form also has a checkbox marked ‘Save my name, email, and website in this browser for the next time I comment.’
This checkbox is a vital step toward GDPR compliance for your website.
Because you are not collecting any personally identifying information from your visitors, you can uncheck this box.
To delete the ‘Save my name…’ checkbox, put the code below to your functions.php file:
add_filter( 'comment_form_default_fields', 'wpdruggy_comment_form_hide_cookies_consent' );
function wpb_comment_form_hide_cookies_consent( $fields ) {
unset( $fields['cookies'] );
return $fields;
}
After saving your modifications, the ‘Save my name…’ message will be removed from your WordPress comment form.

Some visitors will want to keep their personal information hidden. Other people may want to share their contact information with you. If you do remove the ‘Name’ and ‘Email’ fields, you may wish to provide visitors with another option for sharing their personal information.
A contact form allows visitors to reach out to you directly and receive a tailored answer. To learn more, check out our step-by-step tutorial on how to create a contact form in WordPress. You may also use email capture tools to gather contact information from prospective customers and stay in touch with those who visit your website.
Also, Read More Relevant Articles
- How to Add Ads Within Your Post Content in WordPress
- How to Fix WordPress Keeps Logging Out Problem
- What is an SEO Friendly URL Structure in WordPress
- How to Display Related Posts by the Same Author in WordPress
- How to Ask Google to Recrawl URLs of Your WordPress Site
- How to Easily Add JavaScript in WordPress Pages or Posts – 2 Methods
- How to Use User-Generated Content in WordPress to Grow Your Business
- How to Disable Theme and Plugin Editors from the WordPress Admin Panel
- How to Fix ‘Failed To Load Resource’ Error in WordPress
- How To Fix “The Link You Followed Has Expired” Error in WordPress
The Final Conclusion
Finally, allowing anonymous comments on WordPress may promote a more open and diverse discourse within your community. By allowing individuals to voice their ideas without exposing their identities, you promote freedom of expression while potentially increasing engagement on your site. However, implementing moderating tools is critical for maintaining a courteous and constructive atmosphere. With the proper balance of anonymity and accountability, you can foster an open and vibrant community in which all perspectives are heard.
