How to Allow Users to Post Anonymous Comments in WordPress By - TopicsExpress



          

How 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. In this article, we will show you how to allow users to post anonymous comments in WordPress. We will explain how to hide name and email fields from WordPress comment form. Pseudonym: The Ideal Solution The best way to allow anonymous comments in WordPress while limiting comment spam is by encouraging 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 in your comments policy and place a prominent link to it above your comment form. While this is the ideal solution, and the only one that we recommend, there are other solutions to allow further anonymity. However the more anonymity you add, the higher your spam will be. Making Name and Email Optional The next layer of anonymity you can add is make the name and email field completely optional. No nicknames or anything. If a user submits just a comment without name and email, it will go through. Let’s take a look at how to make name and email fields completely optional. First thing you need to do is go to Settings » Discussion and uncheck the box next to ‘Comment author must fill out name and e-mail’ option. Now you need to save your changes, and your site will be ready to accept comments without name and email address. Simply removing this checkbox wouldn’t tell your users that they can leave comments without providing a name or email address. You may want to communicate this by showing that name and email fields are optional. We also suggest removing the website URL field to discourage spam. To do this, you need to modify your comment form. Simply copy and paste the following code in your theme’s functions.php file or in a site-specific plugin. 01 function wpb_alter_comment_form_fields($fields) { 02 03 // Modify Name Field and show that its Optional 04 $fields[author] = . . __( Name (Optional) ) . . ( $req ? * : ) . 05 ; 06 07 // Modify Email Field and show that its Optional 08 $fields[email] = . __( Email (Optional), twentythirteen ) . . 09 ( $req ? * : ) . 10 ; 12 13 // This line removes the website URL from comment form. 14 $fields[url] = ; 15 16 return $fields; 17 } 18 add_filter(comment_form_default_fields, wpb_alter_comment_form_fields); This code simply adds (Optional) next to name and email fields in your comment form. It also removes the website URL field from the comment form. If you want to keep the website URL field, then remove that line of code.
Posted on: Thu, 22 Jan 2015 05:28:27 +0000

Trending Topics



Recently Viewed Topics




© 2015