Fine-tuning the comment form. How to set up the commenting form correctly - for yourself ... All add a comment comment

Dmitry Dementiy

The convenience and functionality of the commenting system affects the engagement of the audience 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 do we need external commenting systems

To discuss posting on a WordPress site with a stock commenting system and default settings, you'll have to manually enter your name and email address. The same problem exists with standard systems for discussing other popular engines. Because of this, you lose a lot of comments, as users don't want to waste authorization efforts.


Third-party commenting services provide the following features:

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

Below you will find an overview of the most convenient external commenting systems.

What alternative commenting systems can be used on the site

Free and paid commenting services are available to site owners. Mini-overviews provide general information about each system, as well as instructions for installing and configuring on WordPress sites.

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 sites every month.

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

How to install Disqus on a website


On the site settings page, specify the name of the resource and select the URL on the Disqus platform. Use the drop-down menu to define 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 site, advertising is displayed in the commenting system. Disqus only shares ad 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-profit sites, personal blogs that do not display ads, the Plus plan can be activated 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 no more than 150,000 per day. On a professional level, there is additional functionality: advanced analytics, priority support, advanced moderation capabilities.


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


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


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

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


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


  • Enter your Disqus profile access credentials.
  • Select the site where you are installing the commenting system.
  • Export comments that users left before installing the system to Disqus. 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, specify the site URL. Make sure that the checkbox next to Enable recommendations for your site is checked. Select the language for the comments interface. Save your changes.


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


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

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


Check the boxes next to the two options in the Flagged Comments section. This allows users to alert moderators of unwanted comments. Also, after the number of marks specified using the dropdown 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 monitor the number of comments and marks "Like" and "Dislike", assign moderators, import and export comments. Please note that exporting comments to Disqus allows you to back up a file with comments. This feature cannot be used to transfer user-generated content to an alternative commenting 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.


All comments are displayed in the Moderate Comments menu. Please note that comments on review are in the Pending folder. They are not displayed on the site unless approved by the 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 need to do is respond to an email notifying you of a new message on the site. To approve the comment, specify Approve in the response; to delete or send to spam, specify Delete and Spam, respectively.

Disqus disadvantages

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


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


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

Cackle commenting service

Cackle is a paid solution. It seems that the developers have taken into account the disadvantages 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 ability to authorize through accounts in popular networks on the Russian Internet. Other features of the system are below.

How to install Cackle on a website

After registering and confirming your account, the system will offer to create a new widget. Enter the site URL and the name of the widget and click the "Continue" button.


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


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 API keys 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:

Cackle's comment form interface is very similar to Disqus. Users familiar with Disqus will simply 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 reach. On the other hand, users can be annoyed by posting messages to 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 Cackle admin panel, select the appropriate menu. On the "General" tab, pay attention to the item "Delete comments". You can disable this feature or allow it within a few minutes after 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 points:

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

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


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


On the "Captcha" tab you can connect reCAPTCHA service from Google , and on the "Spam protection" tab it is possible to connect the Akismet antispam service.

You can moderate comments in the WordPress dashboard or in the admin panel on the Cackle website. Also you can install a mini moderation widget. With its help, comments can be moderated directly on the site.

Disadvantages of the Cackle system

Cackle is a paid service. This is its main disadvantage compared to Disqus. The cost of using one site is 200 rubles per month. Is it worth spending money to authorize users through Vkontakte and Odnoklassniki? This is the main question, according to 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 disable 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 networks popular on the Russian Internet. Three tariffs are available to users:

  • Personal. Costs $ 24 per year, can be used on one site. Supports up to 500 thousand widget downloads per month.
  • Professional. Three sites, $ 120 per 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. Learn more about the system's capabilities further.

How to install and configure HyperComments


Click "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 with your Google account. On the settings page, select the Settings tab. Import existing comments into the system.


The rest of the basic settings do not need to be changed. Advanced settings are available on the Comments tab in the corresponding menu.


In the General section, enable notifications to the administrator and moderators when a new comment is posted. 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 appropriate widget. It allows users to highlight a piece of text and share it with followers on social media.


In the HyperComments section, keep the default settings. This function allows you to annotate individual pieces of text.


In the "Stereo comments" 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 the company logo to the author column.



Disadvantages of the HyperComments system

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

The service discriminates against users who do not have social media accounts. If you turn off the anonymous commenting option, such visitors will not be able to leave a message.

Another important drawback is that the system, by default, does not inform users about new comments. 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 website hosting service WordPress.com. Therefore, IntenseDebate integrates especially well with 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. Enter 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, enable notifications about 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 comments pagination, select the maximum value in the Comments per page field. If necessary, specify the text that will be displayed under the comment form.


In the Comments menu, enable the ability to log in with Facebook and Twitter. Use the system prompts to create a Facebook app and get an API key. Check the box next to the Enable "Report this comment" button. You will enable the "Report a comment" button. Select the option for displaying trackbacks. They can be posted with custom comments or in a separate area. For most projects, the second option is suitable.


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

  • Comment Statistics - Shows the number of commentators and posts.
  • Latest comments.
  • Popular publications. This widget displays a list of the most discussed posts.
  • Active commentators. The add-on displays the ten most active users with a link to their profiles in IntenseDebate.


You can moderate posts 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 have to log in with their Facebook, Twitter, WordPress.com accounts, register with IntenseDebate, or provide their name and email address.

Tolstoy comments

The 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 in which readers can communicate. The communication process is gamified using a system of badges and ratings.

How to install Tolstoy comments on a website

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, a comment widget will appear on the site.


In the control panel on the Tolstoy comments site, adjust the size of the widget. Choose a suitable loading time for the widget. The rest of the settings do not need to be changed.



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

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


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

Disadvantages of the Tolstoy comments system

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

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


Alternatives to universal systems

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

To set up a Facebook comment form, use

Hello!

Today's article is about displaying WordPress comments... We will consider in which files and functions the code responsible for displaying comments is located. What you need to do to be able to make changes to this WordPress blog block.

To begin with, each WordPress template (theme) has a file comments.phpThe full path to it from the root directory: /wp-content/themes/template_folder/comments.php

Exactly comments.php is responsible for the general comment block in a specific WordPress theme.

What is most often contained in comments.php:

- checking the password protection of comments

- checking if comments on the article are allowed

- checking for comments and displaying the corresponding text (“No comments ...” or “N comments left”)

call the function of displaying comments - wp_list_comments ()

- display of navigation (paging) for multi-page comments

- output of the form for leaving comments on the article

It is clear here that you can set your classes or change properties in style.css for already existing classes. Thus, you can change the appearance of the comment and text form before and after the comment list or form. But the output styles of the comments themselves in comments.php cannot be changed.

When I was listing the contents of the file comments.php, then specially noted underlining that in comments.php there is just a call to the function for displaying comments wp_list_comments ()but not the output itself. Those. in comments.php you will not find (at least in the latest versions of WordPress and with the right approach to template development): displaying the author's name and a link to his site, displaying the author's avatar, displaying the date and time of the comment, the comment itself and the “reply” link.

How do you change the styles in the comment list?

First, you need to find out if your template uses a custom function to display comments.

Calling the wp_list_comments () function is possible without a callback (callback function) and with a callback.

1. Calling wp_list_comments without a callback:

Those. in the parameters of the function (what is in brackets after the name) the parameter with the name 'callback' does not appear anywhere.

If in comment.php your template is such a situation, then this means that this topic does not have its own (custom) function for displaying comments and it uses a standard template (template from WordPress core). It is located in the file. And since, then in this case, it will not work to change the display styles of comments until we move on to the second option.

2. Calling wp_list_comments with a callback:

"type \u003d comment & avatar_size \u003d 48 & callback \u003d custom_comment") ; ?>

callback \u003d custom_comment indicates that we have a custom function to display comments custom_comment , the code of which, roughly speaking, we pass as a parameter for execution to the standard function wp_list_comments... But we are no longer interested in the technical side of this issue, but in the presence in the template of its own function for displaying comments. The code for this function is located in.

Exactly in this custom function custom_comment and the code is located that is responsible for the appearance of an individual comment, and therefore all comments as a whole.

The custom function code is intuitive. It typically uses the following standard WordPress functions:

get_comment_author_link () - gets an html link to the site of the author of the current comment;

get_comment_date () - gets the date of the comment;

get_comment_time () - gets the comment time;

comment_text () - displays the text of the comment;

You can find snippets with these functions in code and change the appearance of certain elements by wrapping them in divs or spans and assigning specific style classes.

For example, in the code of a custom function, a fragment of an avatar display:

< div class = "comment-author" >

< / div >

Now left in style.css set the desired properties to the class comment-author... More specific examples of changing styles will be discussed in one of the following articles.

Now you may be wondering: “ What if my template doesn't have a custom function to display comments?

Answer: you need to create it.

The easiest option is to copy the code of the standard WordPress function comment ().

Instructions for creating a custom function for displaying comments:

1. Open the file /wp-includes/comment-template.php and find the function in it comment ().

Here is the beginning of its description

/ ** * @since 3.6 * @access protected * * @param object $ comment Comment to display. * @param int $ depth Depth of comment. * @param array $ args Optional args. * / protected function comment ($ comment, $ depth, $ args) (

* @since 3.6

* @access protected

* @param object $ comment Comment to display.

* @param int $ depth Depth of comment.

* @param array $ args Optional args.

protected function comment ($ comment, $ depth, $ args) (

2. Copy the whole body of the function comment ().

You need to copy a piece of code from the beginning of the description shown in paragraph 1 to the closing curly brace } and the following similar description of another function

Honestly, when I saw what they write about this and advise newbies on other sites, I was a little horrified and decided to write down my note on this topic without a fatal flaw. Basically I've seen long pieces of code that implement adding comments to the site... Usually a form is created for this, its processing, saving, as well as selections for display are implemented. But the benefits of such an approach become less and less.

In this post, you will learn one of the easiest (but, subjectively, one of the most preferable) ways to add comments to the site - a simple example for beginners + options for more advanced webmasters.

Indeed, why reinvent the wheel and write a bunch of code that will still have to be maintained, fixed, etc. in the future, if there are a bunch of ready-made solutions from third-party services (we are talking about social networks + disqus)?

But before we move on to the direct implementation, let's consider the advantages / disadvantages of using ready-made solutions. (If you forgot about anything - write in the comments - we will expand the list)

Benefits of third-party solutions:

  • Ease of implementation.
  • Protection against spam "out of the box" (in my decision I would have to implement this additionally, so, in theory, it is related to the previous point).
  • Less prone to errors, bugs, etc., since third-party solutions have been tested by millions of users (again related to the first: you can also write everything without bugs, but it will take additional time to debug).
  • As a rule, the services provide a ready-made admin panel, statistics, notifications for admins, sometimes moderation, several admins, pre-moderation, etc., which can take months, if not years, for a webmaster, especially a beginner, to implement.
  • The user does not need to register, enter his name, etc. - it is assumed that he already has an account on the popular social network.
  • Most likely, it will withstand a heavy load due to the fact that social. platforms were originally designed for heavy loads.

Disadvantages:

  • Poor or complete absence of the ability to change the appearance of the block with comments.
  • Search engine indexing.

As you can see, there are many more benefits. The inability to change the appearance is most likely done in order to recognize the style of the comment service, thus creating an unobtrusive advertisement. (As one of the options). As for indexing, is it really so important, because not all comments carry a semantic load.

But enough theory, let's move on to practice.

1. The simplest option is to add comments using a selected social network.

For example, vk. We look at the documentation. We copy the provided code and add it on the page (pieces of code are taken from the docks by the link, may change in the future, so always copy from the site with the documentation. Here is only a possible example):

1) Add to :

2) Add in the place where we want to see the comments widget (for example, after the note, if we are talking about a blog):

2. Add widgets from multiple services. For example, as on this resource. Switched by tabs:


Add to the markup (twitter bootstrap must be connected to work correctly!) In the place where you want to output comments widget:

But this option is not the best, albeit the simplest. The problem is that with this approach, when the page loads, all widgets will be initialized, regardless of whether the user needs them or not.

This can be avoided by implementing lazy initialization of comment widgets... First, the whole code, then an explanation:

(function (global, $) ("use strict"; $ (function () (var $ tabToggler, initComments, initialized; initialized \u003d ("# vk-comments": false, "#disqus_thread": false); initComments \u003d function (type) (var discussUserName, disqus_config, pageUrl; if (initialized) (return;) pageUrl \u003d "page_url"; switch (type) (case "#disqus_thread": // You need to set this params using your platform "s appropriate way discussUserName \u003d "discussUserName"; disqus_config \u003d function () (this.page.url \u003d pageUrl; return this.page.identifier \u003d "page_identifier";); (function () (var d, s; \u200b\u200bd \u003d document; s \u003d d.createElement ("script"); s.src \u003d "//" + discussUserName + ".disqus.com / embed.js"; s.setAttribute ("data-timestamp", + new Date ()); return ( d.head || d.body) .appendChild (s);)) (); break; case "# vk-comments": VK.Widgets.Comments ("vk-comments", (limit: 5, attach: " * ", pageUrl: pageUrl)); break; default: return;) initialized \u003d true;); $ tabToggler \u003d $ (". comments-wrapper a " ); $ tabToggler.on ("shown.bs.tab", function (e) (initComments ($ (e.target) .attr ("href"));)); initComments ($ tabToggler.closest (". active"). find ("a"). attr ("href")); )); )) (window, jQuery);

Pay attention to the variables, the value of which you must prepare using the methods provided by your platform.

First, we create type mapping comment widgets, variable initialized... Next, the function initComments (type)allows initialize comment widgetand it does nothing if it has already been initialized.

And the final touch - we initialize the default comments widget so that it is displayed immediately after the page is loaded.

Ready script and coffeescript on gist. An example of work is below (code examples are taken from this site)

(in which we removed the h3 tags in the header before the comment form) - today we will make the WP comment form function work entirely according to our rules:

we will be able to set our own styles, change the title "Add comment" at our discretion, exclude, if necessary, certain input windows, for example, the url form, customize placeholder, etc. and, most importantly, do not lose it all when updating the engine.

Today we can easily fulfill our goal, just by editing the function file. And if you feel the strength to edit the site code (this method is a little more complicated than the one described earlier) ...

Let's start the concert:

is it worth editing WordPress core

As you know, editing the WordPress core (CMS files) is not a recommended activity, mostly due to the fact that after the engine is updated, the developments are lost! Moreover, for novice resource administrators, these WordPress updates are made suddenly (without their knowledge) how to avoid this, read this.

is it worth updating WordPress

Definitely yes! ... there can be no disagreement! ... however, as mentioned, this is fraught with the fact that the engine update will overwrite the administrator's editions!

Therefore, many webmasters, for more flexible settings of their site, use all sorts of filters (hacks): not bad too! However, I (and not only me) prefer to transfer some minor (relative to the importance of constant updates) functions of the WP core to the root of the template.

Thus, output the necessary adjustments to the theme files in order to manage the site state at the template level: without any losses)

Let's start editing, but !!

... I remind you every time: start some kind of document "memorizing" all the exs made with the blog. Copy the files being edited. It will come in handy!

Believe me: this is shorter to the point of professionalism, because the possibility of digesting the accumulated grains of knowledge into a mess is unlikely!

What we need to achieve the goal:

move from the core WP (from the file comment-template.php) the processing of the comment_form function to the template directory.

where to find file comment-template.php

Follow this path your_domain / wp-includes file comment-template.php

... open it (or directly on the hosting - I do this), or download and edit it in Notepad ++ - read: how to customize Notepad ++

Look for a line like this (approximate line # 2111)

function comment_form ($ args \u003d array (), $ post_id \u003d null) (

do_action ("comment_form_comments_closed");

Copy and transfer all this to your functions.php file.

Usually, all new code additions are placed before the closing?\u003e Tag. But I recommend grouping the added code, so to speak, by topic, then you can easily find everything if necessary.

The next step will be to change the name of the function: you can name it whatever your heart desires, at least designate it with a nominal monogram ... I got it like this:

function my_my_ comment_form

We keep the developments ...

... and go to your theme file comments.php.

In this file, we need to change the name of the function call to what we called in the first step:

Look for the following phrase in the document (it is usually in its final): and just add my_my_ or your name.

It should look like this:

... now the task of calling a new function is completed: the template logic will use our code copied into the theme!

What we needed!

Now all you have to do is edit the code of the newly-made function my_my_comment_form () to suit your needs;

... or set individual handling of placeholder - see how it looks for me:

... in my window of the commenting form there is a monogram "Your comment ..." which disappears as soon as the commentator types his message ...

... and so ... and so ... like that.

If you have any questions about adding / removing elements of the commenting form, write, we'll figure it out ...

or you can read a post about useful snippets (

Recently, one of our readers asked if it is possible to enable anonymous commenting in WordPress. By default, users cannot leave comments in WordPress without specifying their name and email address in the comment form. In this article, we will show you how to allow users to post comments anonymously in WordPress. We will also show you how to hide the name and email fields from the comment form.

Alias: 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 while at the same time allowing users to remain anonymous. Commentators will still have to provide their email address, but most people who want to remain unknown will use additional mailboxes.

You can write 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 anonymity a site has, the more spam there is.

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 only submits a comment, no name and no mail, it will go through. 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 specify the name and e-mail." Now you need to save the changes and your site will accept comments without a name or mail.

Simply removing this checkbox will not inform users that they can now leave comments without specifying 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 the amount of 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 into:

Function wpb_alter_comment_form_fields ($ fields) (// Modify the Name field and display it optional $ fields ["author"] \u003d "

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

"; // Modify the Email field and display it optional $ fields [" email "] \u003d" "; // This line removes the Site field from the comment form. $ Fields [" url "] \u003d" "; 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 keep the "Site", then just 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 inserted 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 won't 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, to a file style.css:

Comment-notes (display: none;)

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

Anonymous comments warning

Note that without the required email name fields, your form will attract a lot of spam. Even though Akismet and Sucuri might 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 many styles for comment forms, so if you want to know more on this topic, read our article.