Occurring add a comment comment. Setting up comments in WordPress

This name does not interfere with many, but sometimes the question arises how to change add a comment to leave a review or the like. In this case, this article will help you. As I wrote above, I will show a couple of ways.

Method number 1

For the first method, you must find the file in the folder with the theme that is installed on your site. comments.php. If there is one, open it and look in it for an array responsible for setting up and displaying the content of the comment form. It looks something like this:

$args = array("comment_notes_before" => "

", "comment_field" => "

", "id_submit" => "comm_subm", "label_submit" =>

So, to this array, you need to add a new parameter with the desired value and that's it. In our case, this is:

"title_reply" => "Leave your own review",

How do you understand - Leave your review, this is the new name instead of - Add a comment. You can add such a parameter to the end or to the beginning of the array. It will turn out something like this:

$args = array("title_reply" => "Leave your comment", "comment_notes_before" => "

Fill in the fields below. Your e-mail will not be published. Required fields are marked *

", "comment_field" => "

", "id_submit" => "comm_subm", "label_submit" => "Submit",); comment_form($args);

Added to the beginning and now, on the pages of entries, a line will be displayed - Leave your review. This method is not complicated and requires minimal effort, the main thing is to correctly define the array. But sometimes it happens that there is no comments.php file inside the theme or there is no array in it and you don’t know how to add it there correctly, then the second method will help you.

Method number 2

The essence of the second method is to add a new function, which will make the replacement of the name. To do this, in the folder with the active theme, you need to find the file functions.php with custom functions and in a convenient place, if you don't know this, then at the very end before the PHP closing tag - ?> , if there is none, then just at the very end, add the following code:

Function wph_change_submit_label($defaults) ( $defaults["title_reply"] = "Submit Your Feedback"; return $defaults; ) add_filter("comment_form_defaults", "wph_change_submit_label");

Bonus

This is the same, in fact, what was done in the first method, simply, there we embedded directly into the array, and here through the filter. After these steps, you will see a change in the title. As in the first method, you can change the text - Leave your review to the one you like. This text is provided as an example.

I also want to suggest and pay attention to the declension of the word Comments. If you have a line in the form - 1 comment or Comments: 10 posted. You can use the Function from the article. If you are already using it, then I recommend in line with an array:

Array("comment","comments","comments")

Change the titles to review,review,reviews if you used that word in the methods above. thus, everything will be the same for you, and not in a scatter, there are reviews, and there are comments.

This is the information I would like to share with you today. Perhaps it will be useful to someone.

That's all, thanks for your attention. 🙂

Dmitry Dementy

The convenience and functionality of the commenting system affects the audience engagement and the number of comments on the site. In this article, you will find reviews of the best external commenting systems to help you choose the best solution.


Why external commenting systems are needed

To discuss posting on a WordPress site with the default commenting system and default settings, you will need to manually enter a name and email address. The same problem exists in regular systems for discussions of other popular engines. Because of this, you lose a lot of comments, as users do not want to spend effort on authorization.


Third-party commenting services provide the following features:

  • Ease of authorization to participate in the discussion. Here you need to find a balance between the desire of the user to leave a comment as soon as possible and the need to obtain data about the commentator from the owner of the resource.
  • Involving the audience in the discussion. Third-party services notify users of new comments.
  • Storage of comments. Third party systems store user comments on their servers. This saves disk space and reduces the load on the site owner's server.
  • Possibility to rate comments.
  • Possibility to recommend comments.
  • Expanding audience coverage by automatically posting comments on user profiles in social networks.
  • Ability to insert visual content into comments.

Below you will find overviews of the features of the most convenient external commenting systems.

What alternative commenting systems can be used on the site

Website owners have access to paid and free commenting services. The mini-reviews have general information about each system, as well as installation and configuration instructions for sites running WordPress.

Disqus commenting system

Disqus is the most popular third-party commenting system. According to the creators, with its help, users write 50 million comments on websites every month.

Due to its popularity, Disqus can be considered a benchmark or starting point for evaluating other external commenting systems.

How to install Disqus on a website


On the site settings page, enter the name of the resource and select the URL on the Disqus platform. Use the drop-down menu to identify the category your site belongs to. Click the Next button.


In the next step, choose a plan. The following options are available:

  • Base. Free plan for any sites, ads are displayed in the commenting system. Disqus only shares advertising revenue with sites that meet the platform's internal criteria.
  • Plus. The subscription price is $9 per month. The plan allows you to turn off ads. For non-commercial sites, personal blogs that do not display ads, the Plus plan can be connected for free. The number of views should not exceed 50,000 per day.
  • Pro. The cost is $89 per month, the number of page views is not more than 150,000 per day. In the professional plan, there is additional functionality: advanced analytics, priority support, advanced moderation options.


On the next page, the system informs that you can monetize the site using Disqus. The feature is available for English resources. Click the button marked in the illustration to confirm that you are familiar with this feature of the system.


Select the platform your site is running on. If there is no ready-made solution, use a universal code.


The system will prompt you for instructions on how to install the Disqus plugin for WordPress. Proceed like this:

  • In the WP console, select the "Plugins - Add New" menu.
  • In the "Search plugins" field, enter the query Disqus.
  • Install and activate the plugin.
  • On the installed plugins page, in the Disqus Comment System line, select the Configure menu.


  • The system will prompt you to update the database. Accept the offer.


  • Enter your Disqus profile credentials.
  • Select the site on which you are installing the commenting system.
  • Export to Disqus the comments that users left before the system was installed. To do this, go to the plugin settings menu. In the Import and Export section, click the Export Comments button.


You have installed the plugin and connected the commenting system to the site. Users can now discuss your posts. And you need to pay attention to the service settings.


Disqus commenting system settings

Go to the community settings menu on the Disqus website. On the Settings tab, in the General section, enter the website URL. Make sure the Enable recommendations for your site option is checked. Select the comment interface language. Save your changes.


In the Community section, in the Moderator Badge Text field, select the text that will be displayed next to the name of users with moderator rights. Use the drop-down menu to select how comments are displayed. The following options are available: new on top, old on top, and best on top.


If necessary, allow anonymous users to leave comments. Please note that such commenters are not notified of discussion updates. This reduces their engagement. In addition, the ability to leave comments anonymously can attract trolls and spammers to the site.

Check the box next to the Links in Comments option. In this case, the system will automatically send any comments with links for moderation. Make sure the Media Attachments option is checked. This is permission to post images and videos in the comments.


Check the boxes next to the two options in the Flagged Comments section. This is how you allow users to notify moderators of unwanted comments. Also, after the number of marks specified using the drop-down menu, the system will hide the suspicious comment until the complaint is considered by the moderator. Save your changes.


In your Disqus account on the Community tab, you can track the number of comments and likes and dislikes, assign moderators, import and export comments. Note that exporting comments to Disqus allows you to back up your comment file. This feature cannot be used to migrate user-generated content to an alternate comment system.

Pay attention to the Word Filter function. In the corresponding menu, you can add stop words, when used, the system will send a comment to the Spam folder.


The Moderate Comments menu displays all comments. Please note that the review comments are in the Pending folder. They are not displayed on the site unless approved by a moderator. On the Spam and Deleted tabs, you can view spam messages and deleted comments.

Helpful Hint: You can quickly approve or delete a comment using email. All you have to do is reply to the email notification of a new post on the site. To approve a comment, select Approve in the response, to delete or send it to the spam folder, select Delete and Spam, respectively.

Disqus Disadvantages

The most popular external commenting system has several disadvantages. Here are the most important ones:


  • According to some reports, Disqus reduces audience engagement. For example, in the summer of 2015, the WordPress CMS blog WPBeginner abandoned Disqus due to reader complaints. After that, the number of comments increased by 304%.
  • Incomprehensible situation with the indexing of comments. Search engines index them intermittently. For example, the comments left two months ago on one of the texterra blog posts are still unique. Comments written a year ago are indexed, but the Text.ru system shows the Disqus site as a source.
  • No free plan for commercial sites.


Its popularity and functionality have made Disqus the reference external commenting system. Its advantages and disadvantages can be used when evaluating alternative services.

Cackle Commenting Service

Cackle is a paid solution. It is very likely that the developers took into account the shortcomings of Disqus and the peculiarities of Russian-language projects. Thanks to this, the system received important advantages: indexing of comments by search engines and the possibility of authorization through accounts in networks popular in Runet. More on other features of the system below.

How to install Cackle on a website

After registering and confirming your account, the system will prompt you to create a new widget. Enter the website URL and widget name and click Continue.


The system will offer a universal widget code or a code for popular CMS. Select the desired option.


To use the Cackle system on a WordPress site, install the Cackle plugin. In the WordPress Dashboard, select the "Comments - Cackle Settings" menu. Copy the generated keys to the API and site ID from the Cackle admin panel. Paste them into the appropriate fields in the plugin settings menu in WordPress. Activate the widget.


Export existing comments to the Cackle system. Synchronize the widget with the WordPress database.


By the way:

The Cackle comment form interface is very similar to Disqus. Users familiar with Disqus will find it easy to use Cackle.


Please note that the system supports cross-posting of Vkontakte messages. This feature is enabled by default. On the one hand, this can help increase audience coverage. On the other hand, users may be annoyed by the publication of messages in their profile without asking.


How to set up the Cackle commenting system

To use all the features of the service, pay attention to the settings. In the administrative panel of Cackle, select the appropriate menu. On the "General" tab, pay attention to the "Delete comments" item. You can disable or allow this feature within a few minutes of posting. Also in the general settings, you can select the text of the moderator icon and change the order of the icons of social services through which you can log in.


In advanced settings, pay attention to the following items:

  • Turn on pre-moderation of comments containing links.
  • Uncheck the box next to Guest Comments. Anonymous comments do not contribute to user engagement and trust in the resource.
  • Uncheck the box next to "Crossposting". In this case, the system will not automatically publish comments on social networks.

Change the rest of the settings to your liking or keep the default option.


On the "Appearance" tab, pay attention to the "Pagination" item. Pagination degrades the usability of comments. To solve the problem, use the drop-down menu to select "Select" and enter a large value in the "Maximum comments per page" field.


On the Captcha tab, you can connect reCAPTCHA service from Google, and on the "Spam protection" tab there is an opportunity to connect the Akismet anti-spam service.

You can moderate comments in the WordPress dashboard or in the admin panel on the Cackle website. You can also install a moderation mini-widget. With it, you can moderate comments directly on the site.

Disadvantages of the Cackle System

Cackle is a paid service. This is its main drawback compared to Disqus. The cost of using one site is 200 rubles per month. Is it worth spending money to be able to authorize users through Vkontakte and Odnoklassniki? This is the main question, based on the results of the answer to which the owner of a particular site must make a decision.

Another drawback of the service is the non-obviousness of the possibility of participating in discussions for users who do not have profiles in social networks. If you turn off the ability to leave anonymous comments, the system will prompt the reader to log in through the social network. Alternatively, the user can register on the Cackle website. But for this, he must find the icon marked in the illustration.


HyperComments System

HyperComments is a paid commenting system that supports authorization using profiles in popular networks in Runet. Three tariffs are available to users:

  • personal. Costs $24 per year, can be used on one site. Supports up to 500K widget downloads per month.
  • professional. Three sites, $120/year, up to 2 million widget downloads per month.
  • Enterprise. $480 per year, as many sites as you like, up to 6 million widget downloads per month.


In addition to authorization through Vkontakte, HyperComments has other important advantages. This is a hypercomment feature that allows you to highlight a piece of text and discuss it. Also, commentators can share quotes with their subscribers. Read more about the capabilities of the system below.

How to install and configure HyperComments


Press "Next". The system will redirect you to the HyperComments plugin page in the WordPress directory. Install and activate the plugin. In the site console, select the "Comments - HyperComments" menu and log in using your Google account. On the settings page, select the Settings tab. Import existing comments into the system.


The rest of the basic settings can be left unchanged. Advanced settings are available on the Comments tab in the corresponding menu.


In the "General" section, enable notifications for the administrator and moderators about the publication of a new comment. If necessary, enable pre-moderation of all comments.


In the "Structure" section, if necessary, uncheck the box next to the "Allow comments from guests" field. In this case, users will be able to send a message only after authorization through the social network. If you allow aggressive ways to increase your reach, enable cross-posting.


In the "Quotes" section, enable the corresponding widget. It allows users to highlight a passage of text and share it with followers on social networks.


In the HyperComments section, keep the default settings. This feature allows you to comment on individual pieces of text.


In the "Stereo commentary" section, you can enable the corresponding function. It combines comments into two columns: posts by the author and all users. If necessary, you can add a company logo to the author column.



Disadvantages of the HyperComments system

The main disadvantage of the system is the lack of a free tariff.

The service discriminates against users who do not have accounts in social networks. If you disable anonymous commenting, these visitors will not be able to post.

Another important drawback is that the system does not notify users of new comments by default. This reduces audience engagement.

IntenseDebate commenting system

IntenseDebate is an external commenting system developed by Automattic Inc. One of the main projects of the company is the WordPress.com website hosting service. Therefore, IntenseDebate is especially well integrated with the WordPress CMS.

IntenseDebate is a free service. Its functionality is not inferior to the reference Disqus. The system provides site owners with the following features:

To take advantage of the system's capabilities, install it on the site and configure it.

How to install and configure IntenseDebate

After registering in the system, go to the commenting system installation page. Specify the URL of the resource. If you are using WordPress, install and activate the IntenseDebate plugin. Log in to the settings page in the WP console.



In your personal account on the IntenseDebate website, turn on notifications for the publication of new comments. Switch the language to Russian.


In the Layout menu of your personal account, if necessary, change the appearance of the buttons, the size of user avatars and notifications of new messages. To prevent comment pagination, set the Comments per page field to the maximum value. If necessary, specify the text that will be displayed under the comment form.


In the Comments menu, turn on the ability to log in with Facebook and Twitter. Use the system prompts to create a Facebook app and get an API key. Set the flag next to the Enable "Report this comment" button menu. You will enable the "Report comment" button. Select an option to display trackbacks. They can be published along with user comments or in a separate area. For most projects, the second option is suitable.


If necessary, install additional widgets on the site. The following add-ons are available in the corresponding section of your personal account:

  • Comments statistics - shows the number of comments and posts.
  • Latest comments.
  • Popular publications. This widget displays a list of the most talked about posts.
  • active commentators. The add-on displays the ten most active users with a link to their IntenseDebate profiles.


Posts can be moderated in the WordPress dashboard under the "Comments" menu.

Disadvantages of the IntenseDebate system

The main disadvantage of IntenseDebate is the lack of integration with popular networks in Runet, for example, Vkontakte. To participate in discussions, users will need to log in using Facebook, Twitter, WordPress.com accounts, register on IntenseDebate, or provide a name and email address.

Tolstoy comments

Developers position Tolstoy comments as a free system for building a community of site users. This is not a traditional commenting system, but a chat widget where readers can chat. The communication process is gamified with a system of badges and ratings.

How to install Tolstoy comments on the site

After registering on the platform, the system will offer to insert the widget code on all pages of the site.


If everything is done correctly, the comments widget will appear on the site.


In the control panel on the Tolstoy comments website, set the widget sizes. Choose an appropriate time for the widget to load. The rest of the settings can be left unchanged.



Information about messages is available to the administrator in real time in the "Moderation" section of the personal account. Users see a widget on the pages of the site indicating the number of comments and a pop-up window with the highest rated comments.

Users can rate comments. And for activity, the system assigns badges to commentators.


On each page of the site, the widget creates a separate chat. But the list of chats is available to users from any page of the site using the "All chats" link.

Disadvantages of the system Tolstoy comments

The main drawback is that comments are stored on the Tolstoy comments server, and not in the site database. Because of this, user-generated content is not indexed. The developers plan to fix this problem in the future.

In a discussion on the Tolstoy comments site, users say that the widget slows down websites. On the test site, I did not notice such an effect.


Alternatives to universal systems

Instead of universal cross-platform solutions, some site owners install a form of commenting on one social network. Usually it is Facebook or Vkontakte. Some resources have two forms of commenting at once.

To install the Facebook comment form, use

Hello friends and blog guests! Today I will tell you using PHP and MySQL. We will also talk about commenting systems for the site and choose the best one for your site from the ones I suggested.

Question one: via PHP and MySQL?

To do this, you and I first need to create a table in the database of your site, which will be called - comments. This created table will store comments in fields with the following designations:

id is a unique identifier.
page_id- this field will store the identifier of the site page on which this comment is located.
name is the name of the commenter who left this comment.
text_comment- respectively, this is the text of the current comment.

The next step, after creating a table for comments in the database, we need to implement special code for our future comments on the site. This site code will allow our commentators to add their comments to our articles. Here is the code:


This is a simple HTML comment form for a website. You place it on your site in the place where it is convenient for leaving a comment on the post - naturally, under the post itself.

query("INSERT INTO `comments` (`name`, `page_id`, `text_comment`) VALUES ("$name", "$page_id", "$text_comment")");// Add comment to table header(" Location: ".$_SERVER["HTTP_REFERER"]);// Do we redirect back?>

The last step in creating a comment form for a PHP and MySQL website is to display our comments on the website page. Here is the code for this:

query("SELECT * FROM `comments` WHERE `page_id`="$page_id""); //Fetch all comments for this page while ($row = $result_set->fetch_assoc()) ( print_r($row); //Print comments echo "
"; } ?>

That's all! Our simple website comment form is now up and running on the website.

But it's certainly not for a beginner who won't dig through all that HTML, PHP, and MySQL code. Also won't learn how to create a database. He needs everything at once, quickly and without a headache. I'm right? Of course right!

Then let's move on to the next section of my material and learn everything about ready-made comment systems for the site and choose the most convenient, functional and acceptable for your site ...

Commenting systems for the site. Which one to choose?

How to make comments on the site- this is an important question because comments on the site play an important role not only for communication between the site owner and the visitor, but also comments are important for SEO promotion and promotion.

With the help of comments on the site, the position of the site in search results increases, behavioral factors improve, traffic to the site grows, and, consequently, your earnings increase. You see how important comments are for the site!

So let's take a look how to make comments on the site and what commenting system choose the best option?

In general, comments on sites are displayed in many ways. These are special plugins for wordpress engines and all sorts of comments from social networks, such as for example In contact with, Facebook, Disqus. There are also independent services that offer their own comment systems for the site, for example.

I will now give you one tablet that will immediately put everything in its place and there will be no more questions about choosing a comment system for the site:

Here everything is clearly and clearly visible which commentary system is the best and several presented, which are most often used by webmasters on their resources. I think that explanations are superfluous here and the choice is only yours!

I have already made a decision for myself and installed a comment system for my site from Cackle.

By the way, if you have already decided to choose a system for your site, then here is a link that gives 5% discount to purchase the commentary system from Cackle!

And that's all I have for today! Good luck and prosperity to all! See you soon!

WordPress has several types of content such as posts, pages, comments. WordPress is a very flexible platform that allows you to customize the main types of content to suit your site. You can change the look and feel. In this tutorial, we'll show you how to change the behavior and appearance of comments on a WordPress site.

Step 1. Understanding the function comment_form and its arguments

Consider the WordPress comment_form function. It is responsible for displaying the comment form that is displayed on the page or post. The call to this function can mainly be found in the file comments.php in the theme folder. This file is included in various places, for example, in files single.php And page.php, directly or through a call to the comments_template function.

A description of the feature can be found in the WordPress codex.

If you use the comment_form function to render a form, it will be rendered using the default parameters and will contain fields such as name, email (both fields are required), website, and comment content. In the default Twenty Eleven theme, the form will look like this.

Some important arguments to the comment_form function:

  • fields - with its help you can control the output of fields in the comment form.
  • comment_notes_before and comment_notes_after are used to display information before and after the form.
  • title_reply - used to change the title of the response, which defaults to 'Leave a Reply'.
  • label_submit - used to change the text on the comment submit button.

Step 2. Customize the comment form using the function comment_form

Now let's customize our comment form by passing arguments to the comment_form function.

In case we need to customize the fields in the comment form, we need to pass a list of them to the comment_form function. By default, the function uses the following list of fields:

$fields = array("author" => "

" . "" . ($req ? " *" : "") . "

", "email" => " ", "url" => "

" . "

",);

If we need to remove a field, say website , we just need to exclude it from the array and pass the array to the comment_form function.

$commenter = wp_get_current_commenter(); $req = get_option("require_name_email"); $aria_req = ($req ? " aria-required="true"" : ""); $fields = array("author" => "

" . "" . ($req ? " *" : "") . "

", "email" => " ",); $comments_args = array("fields" => $fields); comment_form($comments_args);

In addition, we will also change the name of the form to ‘Please give us your valuable comment’ and the label on the button to ‘Send My Comment’.

To complete the task, we pass the following arguments to the comment_form function:

$commenter = wp_get_current_commenter(); $req = get_option("require_name_email"); $aria_req = ($req ? " aria-required="true"" : ""); $fields = array("author" => "

" . "" . ($req ? " *" : "") . "

", "email" => " ",); $comments_args = array("fields" => $fields, "title_reply"=>"Please give us your valuable comment", "label_submit" => "Send My Comment"); comment_form($comments_args);

The comment form will now look like this:

Step 3 Removing fields from a form with a hook

Also the WordPress comment form can be modified with hooks and filters. This setup can be especially useful when working with a plugin when you need to tweak a few elements but not change the theme files. Filter to add or remove form fields - ' comment_form_default_fields '

Let's remove the URL address field using a filter. The above code can be used in a plugin or in a file functions.php active topic.

Function remove_comment_fields($fields) ( unset($fields["url"]); return $fields; ) add_filter("comment_form_default_fields","remove_comment_fields");

Step 4: Adding Data to the Comment Form with a Hook

We can add fields to the form using the ' comment_form_default_fields ' filter. Let's add the author's age field using a filter and save this field with additional data and display it in the comments.

Add a field like this:

Function add_comment_fields($fields) ( $fields["age"] = "

" . "

"; return $fields; ) add_filter("comment_form_default_fields","add_comment_fields");

#respond .comment-form-author label, #respond .comment-form-email label, #respond .comment-form-url label, #respond .comment-form-age label, #respond .comment-form-comment label ( background: #eee; -webkit-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); -moz-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); box-shadow: 1px 2px 2px rgba(204,204,204, 0.8); color: #555; display: inline-block; font-size: 13px; left: 4px; min-width: 60px; padding: 4px 10px; position: relative; top: 40px; z-index: 1; )

Now our comment form will look like this:

Age is now stored as additional information. You need to use a hook in ' comment_post ':

Function add_comment_meta_values($comment_id) ( if(isset($_POST["age"])) ( $age = wp_filter_nohtml_kses($_POST["age"]); add_comment_meta($comment_id, "age", $age, false); ) ) add_action("comment_post", "add_comment_meta_values", 1);

Once the data is saved, it can be displayed in a comment like this:

comment_ID, "age", true); ?>

Step 5 Setting comments for specific post types

Sometimes you want to use fields in comments only for certain types of posts. Let's change the code to display the age field only for the record type book :

Function add_comment_fields($fields) ( if(is_singular("books")) ( $fields["age"] = "

" . "

"; ) return $fields; ) add_filter("comment_form_default_fields","add_comment_fields");

Step 6. Create a return function for displaying comments

The wp_list_comments function is used to display comments in posts. The WordPress codex describes the feature in detail.

wp_list_comments has a ' callback ' argument which can be used to define a function that is called when a comment is displayed.

In the Twenty Eleven theme in the file comments.php you can find the line:

wp_list_comments(array("callback" => "twentyeleven_comment"));

Let's change it to:

wp_list_comments(array("callback" => "my_comments_callback"));

The my_comments_callback function will be called for every post.

Step 7 Styling the Comments

Now we will change the style of the comment a bit. We will simply display the content of the post and the age field that we added earlier. We will also change the background color for comments.

Function code ‘ my_comments_callback ’:

Function my_comments_callback($comment, $args, $depth) ( $GLOBALS["comment"] = $comment; ?>

  • id="li-comment-">

    comment_ID, "age", true); ?>

    __("Reply ↓", "twentyeleven"), "depth" => $depth, "max_depth" => $args["max_depth"]))); ?>
  • Change the background color like this:

    Commentlist > li.comment ( background: #99ccff; border: 3px solid #ddd; -moz-border-radius: 3px; border-radius: 3px; margin: 0 0 1.625em; padding: 1.625em; position: relative; )

    Recently, one of our readers asked if it's possible to allow anonymous commenting in WordPress. By default, users cannot post 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 leave comments anonymously in WordPress. We will also show you how to hide the name and email fields from the comment form.

    Alias: The Perfect Solution

    The best way to allow anonymous comments in WordPress is to encourage users to use aliases or nicknames instead of their real name.

    This will allow you to build a community and at the same time allow users to remain anonymous. Commenters will still have to leave their email address, but most people who wish to remain anonymous will use additional mailboxes.

    You can specify such options in the comment policy and provide a cross-link to them above the comment form.

    While this solution is ideal, and the only one we recommend, there are other solutions for author anonymity. But remember, the more anonymous a site is, the more spam it will contain.

    Making the Name and Email fields optional

    The next layer of anonymity you can add is to make the Name and Email fields completely optional. If the user submits only a comment, without a name or email, it will pass. Let's take a look at how to make the Name and Email fields optional.

    First of all, you need to go to the section Options » Discussion the administrative panel of the site and uncheck the box "The author of the comment must provide a name and e-mail." Now you need to save the changes and your site will accept comments without a name and email.

    Simply clearing this checkbox will not tell users that they can now leave comments without a name or email. You can notify them of this by marking the appropriate fields as optional. We also recommend that you remove the Site field to reduce spam. To do this, you need to modify your comment form. Just copy and paste the following code into your theme's functions.php file or :

    Function wpb_alter_comment_form_fields($fields) ( // Modify the Name field and display it optionally $fields["author"] = "

    " . "" . ($req ? " *" : "") . "

    "; // Modify the Email field and display it optionally $fields["email"] = " "; // This line removes the Site field from the comment form. $fields["url"] = ""; return $fields; ) add_filter("comment_form_default_fields", "wpb_alter_comment_form_fields");

    This code just adds (Not necessary) to the Name and Email fields in your comment form. It also removes the Site field from it. If you want to leave the "Site", then simply delete the corresponding lines of code. This is how your comment form will look like:

    How to completely remove the Name and Email fields from the comment form

    For those users who want to completely remove the Name and Email fields from the comment form, here is a small piece of code that needs to be pasted into your theme's functions.php file or into :

    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");

    If your form displays text Your email address will not be published(Your email will not be published), you can hide it by editing the theme's comments.php file. Find the tag and replace it with the following code:

    "

    " . __("Name and email address are not required.") . ($req ? $required_text: "") . "

    ")); ?>

    If you cannot find comment_form, then you can simply hide this text by adding the following CSS code to your theme or to a child theme, in the file style.css:

    Comment-notes ( display:none; )

    This is what your comment form will look like without the name, email, and website fields:

    Anonymous Comments Warning

    Note that without the required email fields, your form will attract a lot of spam. And even though Akismet and Sucuri can block some "bad" IPs, we highly recommend adding a captcha to reduce spam.

    We hope this article helped you allow users to comment anonymously in WordPress. We have shown a lot of styles for comment forms, so if you want to learn more about this topic, read our article.