How to Allow Users to Post Anonymous Comments in WordPress
-
by cobra_admin
- 89
Do you want to allow users to post anonymous comments in WordPress?
By default, users cannot leave comments in WordPress without providing a name and email address in the comment form. However, not every visitor wants to share their personal data.
In this article, we will show you how to allow users to post anonymous comments on your WordPress website. We will also show you how to hide name and email fields from WordPress comment form.

Should You Allow Anonymous Comments in WordPress?
Comments allow visitors to leave feedback and suggestions that can help improve your WordPress website.
Blog readers can also use comments to engage with other users. A lively comment section can create a sense of community around your WordPress blog. Some people may even return to a post just to read new comments, which means more pageviews for your site.
The problem is that WordPress does not allow users to leave a comment without sharing their name and email address, and some users are simply more privacy conscious.
They may not always feel comfortable leaving a comment under their real name.
In this case, the most ideal solution is to encourage users to use a pseudonym or a nickname instead of their real name.
This allows you to build a community while still allowing users to be anonymous. Users will still have to provide an email address, but most folks who want to leave anonymous comments have separate emails for this anyways.
You can communicate this by adding a comments policy right above your comment form.
However sometimes, you may want to allow further anonymity by either making the name and email optional, or entirely removing the name and email field from your comment form.
Just be aware that allowing anonymous comments can make your site more vulnerable to comment spam. If you do allow users to post anonymous comments, then you should also use tools to combat comment spam. You can also see our guide on how to moderate comments in WordPress for more tips.
With that in mind, let’s see how you can allow users to post anonymous comments in WordPress. If you prefer to jump straight to a particular method, then you can go ahead and use the links below.
- Method 1. Allow users to post anonymously with optional name and email fields
- Method 2. Remove the name and email fields from the WordPress comment form
Method 1. Allow Users to Post Anonymously With Optional Name and Email fields
The standard WordPress comment form asks the user to type in an email address and name before they can post a comment.
These fields are required by default, but you can make them optional. This means that visitors who feel comfortable sharing their personal information still have a way to enter their name and email address.
To make the comment form’s ‘Name’ and ‘Email’ fields optional, go to Settings » Discussion in your WordPress dashboard.
Here, simply uncheck the box next to ‘Comment author must fill out name and email.’

Once you’ve done that, just scroll to the bottom of the page and click on Save Changes.
Visitors can now comment without typing in their name and email address. However, the standard WordPress comment form still shows the ‘Name’ and ‘Email’ fields as required, so visitors won’t know that they can post anonymously.
With that in mind, you’ll want to add ‘Optional’ labels to the ‘Name’ and ‘Email’ fields. While you’re making this change, we also suggest removing the website URL field from the WordPress comment form.
Many spammers and bots post comments with the goal of placing a link on your website. By removing the website URL field from your WordPress comment form, you can discourage people from posting spam comments.
You can add the ‘Optional’ labels and hide the website URL field by adding the following code snippet to your website.
You can either add this code to your functions.php file, in a site-specific plugin, or by using a code snippets plugin.
123456789101112131415161718 | function wpb_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' , 'wpb_alter_comment_form_fields' ); |
Hosted with ❤️ by WPCode
1-click Use in WordPress
Then, simply save your changes.
If you visit your site, you’ll now see that the ‘Name’ and ‘Email’ fields are marked as ‘Optional.’ You’ve also removed the website URL field from the WordPress comment form.

For more details, see our step by step guide on how to style the WordPress comment form.
Method 2. Remove the Name and Email Fields From the WordPress Comment Form
Another option is to completely remove the ‘Name’ and ‘Email’ fields from the WordPress comment form. This makes it very clear that visitors can post anonymously.
To do this, you’ll need to add some code to your theme’s functions.php file. However, if you add this code to the functions.php file directly, then you risk losing your custom code every time you update your WordPress theme.
Instead, we recommend creating a child theme and then adding the code to that child theme. In this way, you can update your theme without losing the code you added to functions.php. To learn more, please see our step by step guide on how to create a WordPress child theme.
Your other options are creating a site-specific plugin, or using a code snippets plugin.
No matter what option you choose, you can completely remove the ‘Name’ and ‘Email’ fields by adding the following code:
1234567 | function wpb_alter_comment_form_fields( $fields ) { unset( $fields [ 'author' ]); unset( $fields [ 'email' ]); unset( $fields [ 'url' ]); return $fields ; } add_filter( 'comment_form_default_fields' , 'wpb_alter_comment_form_fields' ); |
Hosted with ❤️ by WPCode
1-click Use in WordPress
Now, if you visit your website, you’ll see that visitors can no longer type in their email address or name.

Since visitors can no longer type in their email address, this message is confusing. If you remove the ‘Name’ and ‘Email’ fields, then you should also remove this message.
To delete the ‘Your email address will not be published’ line, open your theme’s comments.php file. You can now find the following section:
1 | <?php comment_form ?> |
Hosted with ❤️ by WPCode
1-click Use in WordPress
Then, simply replace this section with the following code:
12345 | <?php comment_form( array ( 'comment_notes_before' => '<p class="comment-notes">' . __( 'No name or email address required.' ) . ( $req ? $required_text : '' ) . '</p>' )); ?> |
Hosted with ❤️ by WPCode
1-click Use in WordPress
Every theme is different, so your theme may not have a <?php comment_form ?> section.
If you can’t find this code, then just open your theme’s style.css file instead.
You can then add the following code snippet, which will remove the ‘Your email address will not be published’ text:
123 | .comment-notes { display:none; } |
Hosted with ❤️ by WPCode
1-click Use in WordPress
The following image shows how your WordPress comment form will look without this message.

As you can see in the image above, the WordPress comment form also has a checkbox that says ‘Save my name, email, and website in this browser for the next time I comment.’
This checkbox is an important part of making your site GDPR compliant.
Since you’re not collecting any personally identifiable information from your visitors, then you can remove this checkbox.
To remove the ‘Save my name…’ checkbox, simply add the following code to your functions.php file:
12345 | add_filter( 'comment_form_default_fields' , 'wpb_comment_form_hide_cookies_consent' ); function wpb_comment_form_hide_cookies_consent( $fields ) { unset( $fields [ 'cookies' ] ); return $fields ; } |
Hosted with ❤️ by WPCode
1-click Use in WordPress
After saving your changes, you’ll see that the ‘Save my name…’ message has disappeared from your WordPress comment form.

Some visitors will want to keep their private information private. However, other people may want to share their contact information with you.
If you do delete the ‘Name’ and ‘Email’ fields, then you may want to give visitors a different way to share their personal information.
A contact form lets visitors reach out to you directly and get a personalized response. To learn more, you can see our step by step guide on how to create a contact form in WordPress.
You can also use email capture tools to collect the contact information of potential customers, and keep in touch with the people who visit your website.
We hope this article helped you learn how to allow users to post anonymous comments in WordPress. You can also go through our guide on the best analytics solutions for WordPress users and how to allow user registration on your WordPress site.
Do you want to allow users to post anonymous comments in WordPress? By default, users cannot leave comments in WordPress without providing a name and email address in the comment form. However, not every visitor wants to share their personal data. In this article, we will show you how to…
Do you want to allow users to post anonymous comments in WordPress? By default, users cannot leave comments in WordPress without providing a name and email address in the comment form. However, not every visitor wants to share their personal data. In this article, we will show you how to…