One of our readers recently asked us if there is a way to allow users to post anonymous comments in WordPress.
By default, WordPress asks users to enter their name and email when commenting, but not everyone is comfortable sharing their personal information. This can be a barrier to engagement and stop people from giving valuable feedback.
In this article, we will show you how to easily allow anonymous comments on your WordPress site. In turn, this can help with improving user engagement while respecting visitors’ privacy.
Why Allow Users to Post Anonymous Comments in WordPress?
Imagine you’ve written a great blog post, and you are eager to hear what your audience thinks. Comments are a great way to get feedback, understand what content resonates the most, and create a sense of community on your WordPress website.
Comments are also an easy way to see what content is getting the most engagement. You can then create more of this content and get even more interaction.
Visitors also use comments to engage with other readers. Some people may even return to a post just to read the comments, which means more pageviews.
That being said, you’ll want to encourage visitors to post comments on your WordPress blog. If you are using plugins to improve WordPress comments then you are off to a great start.
However, by default, WordPress doesn’t let visitors post a comment without sharing their name and email address. This extra step can prevent people from commenting.
Many visitors hesitate to share their personal information due to privacy concerns or fear of spam emails. As a result, you might see fewer comments and lower engagement levels.
This lack of interaction can be frustrating, especially when you know that an active comment section can drive more page views and create a loyal community around your site.
By allowing users to post anonymous comments in WordPress, you will often get more comments and increase your engagement.
Just be aware that allowing anonymous comments can make your site more vulnerable to spam comments. 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 use the links below:
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.
By adding the following code snippet to your website, you can add the ‘Optional’ labels and hide the website URL field.
You can either add this code to your functions.php file or by using a code snippets plugin.
The easiest way to do this is with WPCode, which is the best code snippets plugin that allows you to easily add custom HTML, PHP, and more to your site without editing theme files. It helps you avoid breaking your website with bad code/
The first step is to install and activate the WPCode plugin. For more details, check out our tutorial on how to install a WordPress plugin.
Start by going to Code Snippets » + Add Snippet. From here, you’ll see a library of ready-made code snippets.
Under ‘Add Your Custom Code’, click on ‘Use Snippet.’
Next, simply give your code a title and select the code type as PHP Snippet.
Paste the code below into the Code Preview text box:
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');
Then, simply toggle on the ‘Active’ button.
Click ‘Save Snippet’ so that the changes take effect.
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.
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 website. We recommend using WPCode for this.
Just like Method 1, you’ll head over to Code Snippets » + Add Snippet. Then, you’ll click the ‘Use Snippet’ button under Add Your Custom Code.
On the next screen, you should give your code a name and choose ‘PHP Snippet’ as the Code Type.
Then, simply paste the following code to completely remove the ‘Name’ and ‘Email’ fields:
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');
Make sure to toggle the custom snippet to ‘Active.’
Then, click the ‘Save Snippet’ button at the top of the screen.
Preview the changes in a blog post to see the difference.
You should see that visitors can no longer type in their email address or name.
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.
If you are not collecting personally identifiable information from your visitors, you may not have to show this checkbox. However, GDPR is a complicated topic, so we recommend reading through our ultimate guide to WordPress and GDPR compliance carefully before making a decision.
Bonus Ways to Improve Your Comments Section
Allowing users to comment anonymously is just one way to improve comment engagement on your WordPress website. We also recommend checking out the following guides:
- How to Redirect Your User’s Attention with Comment Redirect
- How to Add a Simple User Ranking System for WordPress Comments
- How to Feature or Bury Comments in WordPress (2 Easy Ways)
- How to Allow Users to Like or Dislike Comments in WordPress
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 how to limit comment length in WordPress or our expert pick of the best WordPress plugins to improve comments.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
alvina adolf
Thanks for sharing your blog.
WPBeginner Support
You’re welcome!
Admin
chinmay
Thanks for the guidance. This helped me a lot.
WPBeginner Support
Glad our guide was helpful
Admin
Kenneth
Thank you for this article post. It’s really helpful.
WPBeginner Support
Glad our guide was helpful
Admin
Rajesh Kumar
Will it not lead to a lot of spam comments?
WPBeginner Support
There is a chance but this is for users looking to offer this option.
Admin
Heather
so helpful, thank you
WPBeginner Support
You’re welcome
Admin
reem
thanks,for helps
WPBeginner Support
Glad our article could be helpful
Admin
Bahati walker
Thanks a lot for your guide
Juan Pablo
I can’t disable Users must be registered and logged in to comment – dunno why. Any tricks to do it with php function?
Chris
So the first option to label the Name and EMail text area as “Optional” did not work. Instead, the Text areas for both Name and EMail are still there but there are no labels next to them, they are blank.
Hina
How to Comments in WordPress plugins. Please Help
Ahmad
So does links from Twitter activity now count for search
engine optimisation? I heard they help after the Penguin Google
algorithm refresh
Do you participate in any forums?
Usana
I don´t know if it was a concidence but about a month ago I did turn off all comments off and my Alexa Ranking went down (same amount of organic visitors)… what do you think? By the way this is my blog url: (Yes… I do post in Spanish).
Have a great day!
WPBeginner Support
We don’t think Alexa Rankings are important, relevant, or an accurate tool. What you need to measure, is how your users react to change. Check how it affects your bounce rate, user engagement, conversions, and other metrics.
Admin
ajinkya pawar
How to Comments in WordPress plugins
Someone
HEy im anon!… And my IP address?
C.K. Matthews
I’ve created a custom post type that members can use to post questions to forum. In the single-custom-post-type.php I simply omitted the author id tag so the author’s name is anonymous.
What I want to achieve now is that if the post author wants to ask a question to the commented he or she can do so anonymously. Is there a way to edit or create a custom comment form to do something like if(!author() ) show comment author name?
I’m very new to this and I have a custom-comments.php but evidentally what I need is in the comment_form () which at this time I am using Jetpack comments.
Please advise.
Coupontray
Its better to use Disqus to handle Anonymous comments in any platform.