- Why Do You Need to Manage Comments
- The WordPress Comments Dashboard Interface
- What is Discussion or Comments Settings Page
- What is Comment Moderation
- Add Comments to an Existing Post
- Edit, Delete and Approve Comments
- How to Delete Comments using phpMyAdmin
- Disable Comments on Specific Pages or Posts
- How to Optimize WordPress Comments
One of the great features of WordPress is that it provides a comment system you can use for all of your pages or posts. It opens up a dialog opportunity for the users on your website. They can discuss the content not only between themselves but with you as well. This free feedback is vital in optimizing your website and tweaking it for optimal user experience.
In this tutorial, we will not only show you how to add a comment to a post but also how you should edit, delete, and approve already existing discussion elements.
What are Comments
Comments are an essential part of establishing communication with your visitors. Furthermore, as forums are becoming rarer due to social media taking over their functions, the comment systems are one of the last remaining channels on which you can still have total control as an admin. For example, while you can moderate discussions on Reddit, you still have to abide by their terms of service. But on your website, you have full access to all of the content to the extent that you can even remove comments directly from the database.
By default, comments are enabled on all fresh WordPress installations, and you can approve what exactly appears on your website.
Why Do You Need to Manage Comments #
Managing comments may be tedious, especially if you get a lot of them. Still, the alternative of disabling the discussion options on your website may not be as beneficial as you might think.
Managing your comments shows that you are engaged with your customers even if you do not directly reply to them yourself. It also means that you check and update the content on your website regularly which is good from an SEO perspective. If a visitor sees something interesting on your website and is asking for additional information on a topic via a comment, it will be a good sign that his input is approved and does not sit in the moderation queue for days.
On the other hand, regular contributors will add value to your posts by helping newcomers on your website, which is great for the community you are building and your website’s popularity. Great remarks can stick around for years and add additional points of view on important and relevant topics. There are many cases in which users that don’t agree with the information provided on a website will agree between themselves at some point in the comments.
Auto-approving everything is not a good idea, as your website will quickly attract spammers, and the comments section will look more like a battlefield than a place for advice and communication. WordPress provides some great filtering options in which we will get more in-depth later in this tutorial. Those will help you automate the moderation process as much as possible and save you a great deal of time.
The WordPress Comments Dashboard Interface #
The notes which you will receive as part of the native commenting platform for WordPress can be viewed in your Dashboard → Comments section. In this interface, you can switch between different views – All, Pending, Approved, Spam, and Trash.
Of course, you can move elements between the different categories. Note that the spam view will also contain comments marked as such by Akismet or other Spam plugins.
Furthermore, depending on your discussion settings, the WordPress filter may mark and move comments to this category.
The other thing to note is that mentions located in the trash can only be restored and moved to different categories in 30 days. After that, they will be permanently lost.
What is Discussion or Comments Settings Page #
The Discussion settings page is the place where you will find all of the appropriate options for managing the way comments work on your website. To enter this section, navigate to Settings → Discussion.
As there are a lot of settings you can tweak on this page, we have provided a list with the most commonly used ones:
- Comment author must fill out name and email – Great security setting, as it will help you in keeping track of the comment authors.
- Users must be registered and logged in to comment – Spam generally comes from unregistered users, so adding a login form to the equation will rule out any bots.
Some additional filter options (some of which are enabled by default) which will help you in moderating the discussions on your website include:
- A comment must be manually approved – Enable this to stop comments from immediately appearing on your site. Only after you or another admin have approved them, they will be displayed.
- Comment author must have a previously approved comment – Visitors with an already approved comment, will not have their sequential comments held for moderation as long as they use the same email address.
- Comment Moderation and Comment Blacklist – These two settings have great synergy. The comment moderation setting will only stop comments containing specific words, the number of links, emails, and IPs from being published until you approve them. The comment blacklist option, however, will move matching notes directly to the trash.
In these settings, you will also find the ones regarding user Avatars. While you can configure the most basic things here, be sure to read our optimization tips further into the tutorial. Some of them are regarding 3rd party discussion systems and optimizing avatar requests, which will speed up discussion-heavy websites by a lot.
Once you are done configuring your site, don’t forget to click the Save Changes button at the bottom of the page.
What is Comment Moderation #
Comment Moderation is the act of changing the properties of certain comments to keep the discussion on the topic or remove spam or bad language from your website. With the advancements in WordPress Platform, content creators are required to spare less and less time on comment moderation.
Nowadays, as we have shown in the previous section, you can set a certain standard to which you will like comments to apply. If a comment cannot cover your pre-set requirements, it will be marked by WordPress for manual approval or removal.
Add Comments to an Existing Post #
First, we will begin by adding a comment to an already existing post. By pressing on the link for existing comments, you will be redirected to the post page, and you will be presented with all of the existing comments. There you will find the “Leave a reply” option where you will be able to add your input for that particular post.
Once you are done inserting the text, please use the POST COMMENT
button at the bottom of that interface for your opinion to be posted.
Edit, Delete and Approve Comments #
Assuming that you are logged into the WordPress admin area, you will need to click on the comments element from the left vertical admin menu.
Then you will be redirected to a page where all of the currently existing comments on your website are presented in a table view. To delete a comment from these, you will need to hover over a specific comment and use the Trash link. This will send the comment to the Trash section.
Once the comment is sent to the Trash section, you will be able to permanently delete it if you access the Trash section, hover over the comment you would like removed, and use the Delete Permanently button.
In order for a comment to be approved (assuming that you have activated the comment approval option), you will need to access once again the Comments page where all of the comments are listed. There you will be able to find those Pending comments which you will need to approve.
Once you press the Approve link next to the comment you would like approved, the comment will change its status to Approved. WordPress also offers easy to use links for navigating between the differently categorized comments at the top of the same page.
To edit a comment, you will first have to access the Comments page where all of the comments are listed. They are located in the table view you will notice at the center of the page.
Once you find the remark you would like to edit, please hover over it for the additional links to be displayed and use the Edit link so you can be redirected to the editing interface.
The editing interface is relatively simple. Once you access that interface, you will notice three blocks used for editing your comment.
The first block is related to the details about the author of the piece. The available fields for editing are Name, Email, and URL.
The second block is related to the content of the comment. You should be able to edit it easily with the editing tools WordPress provides.
Once you are done editing the comment, you will need to pay attention to the 3rd block located on the right side of the screen. In this block, you will find the option to View Comment, to set the status depending on how you are categorizing the comment and finally to Update the same with the changes you have performed.
How to Delete Comments using phpMyAdmin #
Another way of managing comments is by utilizing phpMyAdmin. The administration tool can be used to delete comments directly from the database one by one or in bulk via SQL queries.
Warning
Make sure to have a backup of your Database before doing changes via phpMyAdmin. For more information on this visit our “How to Backup your WordPress Database” tutorial.
To delete just selected comments, you will first need to access cPanel → phpMyAdmin.
On the left side of the screen, you will see a list of all the databases in your hosting account. Click on the database, which will contain your cPanel username and the WordPress database suffix _wpXXX. Then select the wp_comments
table.
Table Name
Please note that wp_comments
will likely have two additional characters after wp, for example, wpcn_comments
.
Comments can be grouped by parent and its replies via the comment_post_ID
section if you want to delete entire conversations more easily. To remove a comment, click the Delete button. For bulk deletes, you can use the check-boxes next to each element and then apply the Delete option in the “With selected” section.
The method mentioned above is limited by the number of comments you can delete per page, which is 20 (can be further increased to 500 via the row number option). So if you want to remove thousands of comments, there is another method that jumps over these limitations. Again in the phpMyAdmin interface, for each database, you will find the option to execute queries via the SQL tab directly.
You get a list of all unapproved comments, input the following query:
SELECT * from wp_comments WHERE comment_approved='0';
If you have received a lot of spam which was not filtered correctly and you want to remove all unapproved comments use:
DELETE from wp_comments WHERE comment_approved='0';
Alternatively, if you had auto approving on, you can also remove all approved comments by changing the “0” to “1”.
For removing already categorized spam, execute:
DELETE from wp_comments WHERE comment_approved='spam';
To clean the trash category, you can use:
DELETE from wp_comments WHERE comment_approved='trash';
Disable Comments on Specific Pages or Posts #
Disabling comments on certain posts and pages is possible as WordPress offers individual change of this property. Access the edit post menu and make Discussions available for viewing from the Screen Options.
Now that you can see the Discussion section in the post you want to edit – uncheck the box Allow comments to stop commenting on this post.
Make sure you update the post before leaving to keep this setting. For more options on how to disable comments via the discussion section check our tutorials on the matter.
How to Optimize WordPress Comments #
Optimizing your website’s comment section can have a much greater effect on the overall load times of your website than you think. Comment-rich websites experience 300ms+ increase in load times on posts and pages just because of the extra HTTP requests from Gravatar, loading all comments at the same time and not using lazy loading. In the following sections, we will provide you with tips and popular optimizing techniquest to get your website flying.
Limit the Number of Displayed Comments #
As part of the Discussion settings, you have the option to limit the number of displayed comments per page. This is an excellent tool for lowering the load times of your posts and pages, especially if your websites sparks comments in the hundreds. Note that by default, this option is not enabled, so all comments will be loaded with the page load so re-configuring this is recommended.
To lower the number of loaded comments “per page“, visit the Settings → Discussion interface.
In the Others comment settings section, enable the Break comments into pages with option and add your preferred value for how many posts you would like to load.
Don’t forget to save your settings before you exit the menu.
Load Gravatars Locally #
Even if you lower the number of loaded comments, you will still have to load each individual Avatar. And while empty avatars are usually very slim in size (~1.7KB), the issue here is the additional HTTP requests to Gravatar. As the native WordPress comment system uses Gravatar for fetching the users’ avatars, requests must be made to Gravatar’s server. That is, of course, unless you get Gravatars to load locally or via a CDN.
There is an excellent plugin for using Gravatars locally called WP User Avatar. It is easy to configure plugin that will make your life a lot easier.
Alternatively, you can use – Harrys Gravatar Cache. This plugin is updated regularly, and new features are being added.
Load Gravatars via a CDN #
Using a CDN to serve the avatars your commentators use is a bit tricky as it requires you to both set up a subdomain which is covered by a CDN like Cloudflare and have Nginx on the server and root access to edit its configuration file.
Requirements:
User access to Nginx is only available to our VPS and Dedicated Server clients. Furthermore, Nginx does not come by default with a new server and must be requested via ticket, after which our support will swiftly set it up for you.
Open your Nginx configuration file and add sub_filter
in the relevant location block. Replace /yourdir
with the directory of your WordPress installation. Then replace cdn.example.com with your CDN related subdomain.
location /yourdir { sub_filter 'https://secure.gravatar.com/avatar/' 'https://cdn.example.com/avatar/'; sub_filter_once off; }
Before closing the configuration file, add the proxy location for the redirected avatars.
location /avatar { proxy_pass https://secure.gravatar.com$request_uri; }
Save your changes and reload Nginx. For centOS/Fedora this can be done with:
sudo /etc/init.d/nginx reload
If you are trying to do this on a Debian/Ubuntu system, use:
sudo service nginx reload
After testing a sample page with 50 comments on it, we saw a decrease in load times ranging from 8% to 25%, depending on the location from which the page was accessed. Considering that even just 10% is a great result for optimizing such a small part of your website, loading Gravatars via a CDN is a viable option for users who can cover all of the requirements of applying this optimization.
Use a Third-Party Commenting System #
Some people are not a fan of the native comment system, and that is definitely justifiable. However, the community cannot make their minds regarding an exact to-go choice for a third-party alternative. There are pros and cons to most plugins that are continuously supported, and as such, the user feedback is divided.
For example, Disqus offers some handy features which you cannot find in the native commenting system like Subscribe to Thread, Featured Comment, Premoderating, Guest Moderator, and Timeouts. But it also slows down full page loading considerably in some cases, and the impact of data-gathering on privacy is something which is still being discussed.
We already have a guide on how to integrate Disqus with WordPress, but that does not mean this is the only one. There are other variants like Jetpack, wpDiscuz, GraphComments which offer similar or expanded set of features.
Lazy Load Comments #
Lazy loading or on-demand loading as some users know it is a design pattern used for optimizations via which only the needed information of a page will be served to a user. In our case, as all users expect and logic dictates, the comments are located after the bulk of the content. This means that comments do not necessarily need to be loaded once a page has been accessed. Instead, they can be loaded after a certain % of the page has been scrolled or by accessing a hidden comment section.
Lazy Loading
Depending on the Lazy Load implementation, there might be issues with web crawlers scraping your comments, thus removing the benefit of the comments boosting your SEO.
Lazy Load Native Comments #
While WordPress is not able to add lazy loading to comments, there are a few great plugins that make implementing this technique easy even for beginners. Note that while there are plugins that can help you in lazy loading your videos and high-resolution images, in this tutorial, we will only discuss comment related lazy loading. The peculiar thing in the case of these plugins is that all 3 of the most used ones are made by the same developer. That was something even we haven’t noticed until making the list for this tutorial, so Good Job Joel!
Lazy Load for Comments can both lazy load your comment section, as well as the Gravatars, thus reducing the number of HTTP requests. After installing the plugin, you will get an additional option in your Discussion settings. Via the drop-down menu, you can select if you want your comments to lazy load “On Scroll” or “On Click”. The latter will create a button for visitors to click on so they can view the comment section.
As an alternative to this plugin, you can use the default wpDiscuz plugin.
Lazy Load Disqus Comments #
Those of you who have decided to use Disqus can lazy load your comments with the help of the Disqus Conditional Load. If you have already installed Disqus itself, the activation of the DCL is not out of the ordinary. However, if that is not the case, you will be prompted to first create your Disqus account and complete the base plugin’s setup. Until then, the options provided by DCL will remain grayed out and unavailable to you.
Once ready, access the Disqus Conditional Load plugin via Disqus → DCL Settings.
Here you can select if you want the load to happen On Click, On Scroll, or if you have the pro version – On Scroll Start (this means the comments will not load until the user shows some scroll activity on the page). You can also edit the comments’ width and if you want to use the counter.js
or not. A thing to note here is that this same counter.js can take a few thousand ms of wait time when loading a page.
If you scroll down the options, you will also see customizable messages for the On Click button label and loading text if you choose that option from the drop-down menu above as well as two cache-related options.
Lazy Load Social Comments #
With the free Lazy Social Comments plugin (formerly known as Lazy Facebook Comments), your users can easily add facebook comments to your website just by using their social login, which you can then lazyload. The practice of such one-click entries became widely used by giveaway apps like Gleam.io to log users and verify objective progression.
When you install and activate the Lazy Social Comments plugin, navigate to Settings → Lazy FB Comments.
Here you will see all of the plugin related options starting with the Facebook App ID. This ID will be the thing that connects your website to Facebook. Log into your Facebook account and then access the Developers area. Then click on the My Apps menu → Add New App. Add a name to help you remember what the app is for and click the Create App ID button.
After you create your application, it will be In Development status, until you provide a link to your privacy policy and then click on the OFF slider to switch the app’s status to Live.
Now you need to get the App ID from the top part of the page and paste it in the appropriate field in the plugin.
Now configure the rest of the settings to your likings. That includes the number of initially displayed comments and the way they are sorted. The default sorting method is social, or as most of us are familiar on facebook – relevant. You can also sort by oldest or newest.
The second half of the options include, of course, the way the lazy comments load (On Click or On Scroll) and the appropriate text if you choose the former.
The last option is called ‘Using Along With Other FB Plugins‘. It allows you not to load the Facebook SDK if another plugin that uses the social media’s interaction has already loaded it. This is a nice little addition to the already extensive set of properties you can manage with this plugin.
With the end of the comment optimization section, we will also end this tutorial in its current state. However, we stay committed to adding additional information or switch up plugins on this list in case the current ones are no longer supported in the future.