The post How to Turn Off Comments in WordPress in 5 Different Ways appeared first on PluginsForWP.
]]>If you already have a WordPress site, you know that comments enhance website engagement. They allow readers to air out their opinions, driving traffic to your blog while boosting SEO. This is why most people don’t find the need to turn off their comment section.
Welcome to the ultimate guide to WordPress site comments!
There are both upsides and drawbacks to having comments on your site. For instance, most of the reactions you’ll find are spam and low-quality comments which injure your WordPress Website. In addition, maintaining your website and backing up data is also time-consuming, so freeing time to respond to comments will be difficult.
On the other hand, lacking any comments is suspicious to the web visitors and will negatively affect your website. This is because the comments section is the medium that connects bloggers to their users. So, why do site owners disable it?
The online world is lawless, and you will have to deal with unwanted content, from spam emails to spam comments. Spam links and low-quality comments injure your site. If left unchecked, they create the following negative consequences on your blog:
Spam comments also slow your website loading time, reducing website traffic and keeping potential visitors away.
If you want to keep the comments box enabled but limit the number of spam comments, consider adding reCaptcha to the comments form.
Turning off comments in WordPress significantly increases the performance of your site. Each opinion or comment needs a database request, which drags down your time. So, having a less bulky page will increase your site’s performance.
WordPress comments slow down your post’s loading page through the following process:
In most instances, resources like JQuery and JavaScript have to be downloaded and processed.
Comments on your posts are good for SEO, but they can harm your business if they consume your valuable time. Backing up data and managing your WordPress website already takes up much of your time. So if you also have to manage comments, especially the popular ones, this can take a toll on your business.
The thing about popular comments is that they attract tons of reactions, and if you do not have time to reply, your brand could suffer.
However, it’s important to note that not every website benefits from the comments section. For example, a business website will look less professional with a comments section. Therefore, it’s also ideal for turning off the comments section if a dedicated forum is designed to help your audience communicate.
We recommend that you consider your niche and audience before disabling comments.
There are various ways of disabling comments on your WordPress site, and here are all of them, step by step:
The platform will enable comments on all posts if you have a WordPress site by default. Change this standard setting on your Dashboard to disable comments selectively or entirely on your posts.
First, go to your Dashboard -> Settings -> Discussion.

To stop posts on all future posts, unselect the alternative reading, “Allow people to post comments on new articles.” Don’t forget to disable trackbacks and pingbacks. This will stop comments and notifications on everything you post in the future.
To remove all existing comments, read our how to delete all WordPress comments article.

If you are looking for a more elegant, swift solution, consider using a WordPress plugin. Unlike other methods, plugins give you complete control and eliminate the tedious clean-up process afterward.
Here are two main methods you should consider when installing a dedicated plugin:
Premium plugins are a great way to deal with your comment section. Our top recommendation is the Perfmatters Plugin (or get it from us for only $4.99). It is specifically tailored to enhance the performance of your website. It also comes with tweaks that reduce forthcoming slowdowns and a streamlined dashboard. Perfmatters also provides an easy solution to turning off your WordPress comments.
Here’s how to go about it:
Options tab > Settings > Disable comments section.

This is your perfect plugin if you only need to speed up your site’s website while having your WordPress comments turned off.
You can easily install a free plugin such as Disable Comments, allowing administrators to disable comments globally or for a particular post. This plugin has excellent reviews boasting a 4.9 out of 5-star rating.

It is easy to use and comes with a million active installs. Install the plugin, then go to Settings to Disable Comments.
Install > Settings > Disable Comments.
You can also disable comments globally on your site with a simple click or turn them off for custom post types, pages, etc. With this feature, you’ll have disabled WordPress comments on WooCommerce products, media files, and pictures. Finally, please navigate to the Save Changes button and click on it.

You should, however, note that it’s impossible to override the settings simply by updating the standard WordPress Discussion settings to enable discussions or a particular post or page.
Therefore, it is advisable to use this solution for a site that has multiple users and you want to prevent access to the comment section.
You can also use other Plugins such as Akismet or WP Bruiser.
This option is great if you no longer wish to use or install a plugin. Disabling your site’s comments utilizing this method is quite simple, especially if you have technical skills and experience. Here you’ll use basic HTML commands to dismiss the comments segment from appearing inside the WordPress theme. However, we recommend that you avoid editing the theme’s source code or risk a site breakdown if you do it incorrectly.
Please note: You should only use custom code if you’re conversant with the technical skills required.
First, create a child theme, followed by a site backup. Then disable comments on your site by copying and pasting code snippets to the pages of your themes, single.php file, and page.php. Here’s a quick step-by-step guide.
N/B: Do this on your page.php file using the following steps:
<?php comments_template( '', true ); ?> and replace it with <?php // comments_template( '', true ); ?>.<?php comments_template(); ?> And you should replace it with <?php // comments_template(); ?>.
The WordPress platform often creates single pages every time you upload media files to your site. So, most of the time, you don’t need a comment section on media files. But, most times, you’ll find that pages receive comments like regular posts.
To disable them, you should:
This method is less suitable for sites with huge media libraries. It’s also impossible to apply this setting using Bulk Actions, as you would with custom posts and pages.
You should then turn off comments under all media files by using a custom code to the functions.php folder in your motif. Ensure you input the correct code snippets since incorrect codes can damage your site. We recommend you backup your site if something goes wrong.
function disable_media_comment( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == 'attachment' ) {
return false;
}
return $open;
}
add_filter( 'comments_open', 'disable_media_comment', 10 , 2 );
It is possible to turn off responses on posts and pages one by one instead of disabling them globally. The best thing about this method is its flexibility over comment sections. For instance, you can use it to override the current global setting. We recommend using it when you only want to change the comment settings for a particular post.

You should note that the steps are the same irrespective of your editor. This method, however, does not remove pre-existing comments on the post or page.
Sometimes, with the Gutenberg editor, it’s challenging to find the Discussion box. So, navigate to the top right corner and click on the three-dotted button. Next, navigate to Preferences > Document Settings and then check again.
You can also use the Quick Edit feature, which is located in the admin menu under posts and pages.

Generally, it’s easy to control comments on smaller websites by adjusting settings in WordPress or installing a plugin. Bulky websites, on the other hand, often require third-party solutions.
Choosing to enable or disable comments on your site depends on your niche, audience, and individual preference. Weigh the advantages and disadvantages of responses in your blog and make an informed decision based on your blog type. The ball is now on your court.
Will you keep your comments enabled or disabled? We are curious to know in our comments section below.
The post How to Turn Off Comments in WordPress in 5 Different Ways appeared first on PluginsForWP.
]]>The post How to Add reCaptcha to WordPress Comments to Prevent Spam Comments appeared first on PluginsForWP.
]]>For months we received hundreds of spam comments every day. Luckily, we solve the problem by adding a reCaptcha box to the comments form.
This article will teach you how to add reCaptcha to your WordPress comment form to prevent spam messages.
reCaptcha is the box added to the form above the submit button and asking the user to prove that they are not a robot.
They are widespread and come in different verification options:
The most used one is the ‘I’m not a robot‘ checkmark, just like this one (that’s the one we use).

On the other hand, another popular one is proving that you are not a robot by selecting specific images from the same group as cars.

reCAPTCHA uses an advanced risk analysis engine and adaptive challenges to keep malicious software from engaging in abusive activities on your website. Meanwhile, legitimate users will be able to login, make purchases, view pages, or create accounts and fake users will be blocked.
Official Google reCaptcha website
There are two versions of Google reCaptcha.
reCaptcha v2 – the box that appears inside the form (comments, login, register, etc.). They are the examples I showed you above, which is the version we will use in this tutorial.
The user will need to solve a challenge before submitting the form.
reCaptcha v3 – added to every page (or chosen pages) on your website and will analyze your behavior as a visitor. Human users act differently from bots (dah!!) and, therefore, be legit. It will be blocked if a robot tries to leave a comment or review.

We only want to add a reCaptcha box to the WordPress comments form specifically instead of all pages. Therefore, we will use the reCaptcha v2 type.
As mentioned above, spam comments are not fun and can damage your website or admin’s experience.
Furthermore, spam comments will take space on your database and, if not deleted frequently, will clog and slow it down.
Also, if you get an email notification (like we do) for every comment left on your website, it will pile up quickly. That will slow down your workflow and keep you from focusing on critical emails.

We often skipped valuable comments left by legit users because we assumed they were spam comments. It doesn’t happen anymore after adding the reCaptcha form to our website.
Before we added the reCaptcha feature, we had two options, constantly delete all the comments or turn off WordPress comments altogether, and we didn’t want to do that.
After enabling the reCaptcha option, all comments are legit and approved when receiving comments.
We can add reCaptcha in two different ways. The first way is by installing a plugin, and the second way is by using a PHP function. In this tutorial, we will cover both methods.
Regardless of your option, we will first need to generate our reCaptcha API keys.
Open the Google reCaptcha website and click the v3 Admin Console link to generate the keys.

Then, click on reCaptcha v2 and select the ‘I’m not a robot’ checkbox option. Enter your website’s domain name, accept the terms of service and click submit.

You’ll have both the public and secret API keys on the next screen. Keep this window open, and we will need to copy them shortly.

We can now move on to the second step and use the keys with a plugin or a function.
The first way to add reCaptcha to your website is by using a plugin. First, from inside your WordPress dashboard, navigate to Plugins -> Add New, and install the reCaptcha by BestWebSoft plugin.

Once activated, navigate to reCaptcha -> Settings, choose Version 2 and enter your site and secret keys generated on the last step.
Then, choose the forms you would like to enable reCaptcha for and scroll to the bottom of the page to save the changes.

Once saved, visit one of your blog posts, scroll to the comments section and see the added reCaptcha box.

Follow the section below if you want to use a function instead of a plugin.
We will use a PHP function to integrate reCaptcha with the comments form with this method.
First, navigate to Appearance -> Theme Editor and open the single.php (or singular.php) file of your child theme. Alternatively, you can also access the files by creating an FTP account.
If you don’t have a child theme yet, create one after reading how to make a WordPress child theme article.
Tip: please backup your website before editing core files.
Then, copy the code below and paste it just before the get_header(); function in the single.php file and click save.
wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js');

Once saved, open the functions.php file, scroll to the bottom of it, and paste the code below:
/* Add Google recaptcha to WordPress comment box */
function add_google_recaptcha($submit_field) {
$submit_field['submit_field'] = '<div class="g-recaptcha" data-sitekey="enter_your_site_key_here"></div><br>' . $submit_field['submit_field'];
return $submit_field;
}
if (!is_user_logged_in()) {
add_filter('comment_form_defaults','add_google_recaptcha');
}
/** Google recaptcha check, validate and catch the spammer */
function is_valid_captcha($captcha) {
$captcha_postdata = http_build_query(array(
'secret' => 'enter_your_secret_key_here',
'response' => $captcha,
'remoteip' => $_SERVER['REMOTE_ADDR']));
$captcha_opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $captcha_postdata));
$captcha_context = stream_context_create($captcha_opts);
$captcha_response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify" , false , $captcha_context), true);
if ($captcha_response['success'])
return true;
else
return false;
}
function verify_google_recaptcha() {
$recaptcha = $_POST['g-recaptcha-response'];
if (empty($recaptcha))
wp_die( __("<b>ERROR:</b> please select <b>I'm not a robot!</b><p><a href='javascript:history.back()'>« Back</a></p>"));
else if (!is_valid_captcha($recaptcha))
wp_die( __("<b>Go away SPAMMER!</b>"));
}
if (!is_user_logged_in()) {
add_action('pre_comment_on_post', 'verify_google_recaptcha');
}
Make sure to replace ‘enter_your_site_key_here‘ and ‘enter_your_secret_key_here‘ with the actual keys, we generated earlier. Once replaced, click save.

Finally, visit the comments section on one of your blog posts and verify that the reCaptcha box was added successfully. Go ahead and test the box by leaving a comment.
In this article, you learned how to add a reCaptcha box to WordPress comments in two different ways.
Leave us a comment and tell us which one of the methods you chose to perform this task.
The post How to Add reCaptcha to WordPress Comments to Prevent Spam Comments appeared first on PluginsForWP.
]]>The post How to Delete All WordPress Comments – Easy and Simple appeared first on PluginsForWP.
]]>While most visitors leave comments to share their thoughts with you, others use them to spam your website and promote their products or services.
In this article, I will show you how to delete all WordPress comments in multiple different ways.
Not all the comments left on your website need to be displayed to the public and should be deleted.
Here are the main reasons why you should delete comments from your website.
The Jetpack article can shed more light on how spam comments affect your website.
You will need to delete some or all your WP comments to prevent that from happening.
There are multiple ways to delete comments from WordPress, and in this article, I will show you three ways:
Although there are more ways to delete comments than the three methods above, they are the most common.
You can also reduce the number of spam comments by adding reCaptcha to the comments form or turning off comments in WordPress altogether.
Let’s start deleting the comments using the first way, from the comments screen.
This is my preferred method because you can use the native comments screen of WordPress.
From inside your WordPress dashboard, navigate to Comments.

You’ll see all the comments left on your different blog posts on the comment screen.
You can delete them individually by hovering on the comment you want to delete and clicking Trash.

Moreover, if you want to delete multiple comments, check all the comments you would like to delete, change the bulk actions to the trash, and click apply.

Note: delete only the spam comments and not the legit ones. You can often identify the spam comments when it contains links in their body.
By default, the comments screen shows you only 20 comments per page. Thus, if you have hundreds or even thousands of spam comments piled up, it will take a long time to go through the pages and delete them all.
You would like to display more than just 20 comments per page to speed up the process.
To achieve that, click on the screen options at the right top corner and change the number of items per page to a higher number.

Now you can delete even more comments at once.
In addition to the admin dashboard, we can also delete comments with a plugin.
From your WordPress dashboard, navigate to Plugins -> Add New, search for Delete All Comments of WordPress and install the first result on the left.

Once you activate the plugin, navigate to Tools -> Delete Comments.

On that screen, you’ll have the option to delete all comments whatsoever or by filter:
The Comments in moderations are the ones with the orange background waiting for approval. Most likely, they are the ones that you would like to delete.

Select your choice and click on Delete now.

Once clicked on Delete, please navigate to the comments screen to validate that you deleted them successfully.
Another great plugin you should be familiar with is Delete Pending Comments.

This plugin allows you to bulk delete all pending comments with a click of a button.
Instead of selecting each comment individually or navigating between the many comment screens, we can delete them in one action. That’s a fantastic feature that can save you valuable time.
Thus, activate the plugin and navigate to the comments -> delete pending comments screen.
Once there, enter the I am sure I want to delete all pending comments, realize this can’t be undone text into the field, and click on the Delete Pending Comments button.

Clicking on the delete button will permanently delete all the pending comments from your site. You can then deactivate the plugin and reactivate it in the future when needed.
In this method, we will empty the comments column of our WordPress database. This is the most advanced way of the three; therefore, it’s not recommended.
First, log in to your website’s cPanel hosted on your server and click on the phpMyAdmin link.

WordPress data is stored in different tables in the database. The comments tables are stored in tables that are called comments and commentmeta.
Once you have found the tables, highlight them and click the Empty button on the right.

That’s it. All the comments inside the database tables were deleted successfully.
It’s a good practice to often delete comments from your WordPress website to maintain a healthy website.
In this article, you learned how to delete multiple comments in a few different ways.
Leave us a comment and let us know which one of the methods you used.
The post How to Delete All WordPress Comments – Easy and Simple appeared first on PluginsForWP.
]]>