Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Allow Users to Post Anonymous Comments in WordPress

We have been running a blog with an active comments section for over 16 years. So, we know how important it is to properly manage user permissions and customize commenting features.

Recently, one of our readers asked us if there is a way to allow users to post anonymous comments in WordPress. This is a great question since, by default, WordPress requires users to enter their name and email when commenting.

However, not everyone is comfortable sharing their personal information. And in that case, this can hinder engagement and stop people from giving valuable feedback.

By allowing anonymous comments, you can encourage more people to engage with your content while still protecting their privacy.

We don’t offer this option on our blog, but we definitely see the value in doing so. So, we decided to test different ways to enable anonymous comments, both manually and using plugins. After trying several options, we found that the easiest and most reliable way is using WPCode.

In this article, we’ll show you step-by-step instructions on how to set up anonymous comments on your WordPress site.

allow-users-to-post-anonymous-comments-in-post

Why Allow Users to Post Anonymous Comments in WordPress?

Imagine you’ve written a great blog post and can’t wait to hear your audience’s thoughts. Comments are a great way to get feedback, understand what content resonates the most, and create a sense of community on your WordPress website.

Tracking the comments section is an easy way to see which content gets 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.

So, 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, we’ll show you 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:

Ready? Let’s jump right in.

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, you can go to Settings » Discussion in your WordPress dashboard.

Here, simply uncheck the box next to ‘Comment author must fill out name and email.’

uncheck comment author

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 a custom code snippet to your website, you can add the ‘Optional’ labels and hide the website URL field. You can add this code to your functions.php file. However, we don’t recommend this method as it can break your site.

Using a code snippets plugin is a much better, more beginner-friendly way to do this.

WPCode is the best code snippets plugin 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.

WPCode's homepage

So, let’s install and activate the WPCode Free Plugin. For more details, you can check out our tutorial on how to install a WordPress plugin.

Upon activation, you can 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,’ you can click on ‘Use Snippet.’

add custom code snippet

Note: You don’t need WPCode Pro to use a custom code snippet. But, if you want more features, such as access to over 100 expert-approved code snippets, user access control, social media pixel tracking, and a complete revision history, then you’ll need to upgrade your plan.

Next, simply give your code a title and change the ‘Code Type’ to ‘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, you’ll want to toggle on the ‘Active’ button.

With that done, go ahead and click ‘Save Snippet’ so that the changes take effect.

activate custom snippet

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.

optional name and email in comments

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, and once again, we recommend using WPCode.

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.’

add custom code snippet

On the next screen, you’ll name the custom code snippet 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');

Don’t forget to toggle the custom snippet to ‘Active.’

Then, you can click the ‘Save Snippet’ button at the top of the screen.

save custom snippet

Once done, you can preview the changes in a blog post to see the difference.

You should now see that visitors can no longer type in their email address or name.

no required email or name in comments

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 Tip: More Ways to Improve Your Comments Section

Allowing users to comment anonymously is just one way to improve comment engagement on your WordPress website.

Since comments are important, you should try to get more. One way to do this is by using a comment redirect. When someone leaves their first comment, you might want to send them to a ‘Thank You’ page to show appreciation and encourage more interaction.

Comment redirect page example

For detailed instructions, you can check out our guide on how to redirect your user’s attention with comment redirects.

Then, adding a simple ranking system can encourage people to leave useful and well-written comments. For instance, you can highlight top comments at the top or give badges to the best ones.

Comment ranking system preview

For more on this topic, you can read our guide on how to add a simple user ranking system for WordPress comments.

Similarly, using an upvote/downvote system lets users decide which comments are popular and pushes spam to the bottom. This helps create a sense of community and makes moderating comments easier.

Like or dislike comments in WordPress

You can see the detailed step-by-step instructions in our guide on how to allow users to like or dislike comments in WordPress.

Now, as your blog grows, managing a large community can get tricky. You might want to reward users who contribute valuable comments and discourage unhelpful ones.

For example, someone might leave a self-promotional comment with a link to their blog, or multiple comments could appear that don’t add much to the discussion.

To improve comment quality, you can highlight valuable comments at the top and push irrelevant ones to the bottom.

Feature comment using Thrive Comments

To do this, you can refer to our detailed guide on how to feature or bury 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

23 CommentsLeave a Reply

  1. alvina adolf

    Thanks for sharing your blog.

    • WPBeginner Support

      You’re welcome!

      Admin

  2. chinmay

    Thanks for the guidance. This helped me a lot.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  3. Kenneth

    Thank you for this article post. It’s really helpful.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  4. 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

  5. Heather

    so helpful, thank you :-)

    • WPBeginner Support

      You’re welcome :)

      Admin

  6. reem

    thanks,for helps

    • WPBeginner Support

      Glad our article could be helpful :)

      Admin

  7. Bahati walker

    Thanks a lot for your guide

  8. 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?

  9. 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.

  10. Hina

    How to Comments in WordPress plugins. Please Help

  11. 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?

  12. 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

  13. ajinkya pawar

    How to Comments in WordPress plugins

  14. Someone

    HEy im anon!… And my IP address?

  15. 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.

  16. Coupontray

    Its better to use Disqus to handle Anonymous comments in any platform.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.