The WordPress comment system can be a bless for your blog, because of the user interaction. However, when the WordPress comment option is abused by spammers, it becomes a real pain in the "@ss". With thousands spam reactions, disabling -and removing- WordPress comments is the only way to go. Here is how to disable WordPress comments in both the WordPress Dashboard interface and in your MySQL database.

In the WordPress Dashboard, WordPress has a nifty Discussion Settings in which you can enable - or disable - comments. The disadvantage of this discussion setting is: it only applies to new articles, not old articles.

Disable WordPress comments through Discussion Settings

Assuming WordPress comments are enabled: to disable WordPress comments through the Discussion Settings of the WordPress Dashboard, log on to your Dashboard and browse to Settings > Discussion. Here you'll find a check box Allow people to post comments on new articles. Uncheck that check box.

Now, comments are disabled for new articles and posts. This can be overridden when creating a new post.

enable or disable WordPress comments
WordPress discussion settings

But what if you have a hundred or more posts? Do you have to edit all of them to disable commenting? No! Fortunately, you can use the power of MySQL to disable and close comments for existing posts.

Disable WordPress comments on all posts through MySQL/phpMyAdmin

As said, you cannot close comments on existing posts through the WordPress Dashboard. Unless you want to edit all your posts... Therefore, we'll use the power of MySQL to disable WordPress comments on all posts, in one go. Just to make life a bit easier.

To disable, or close, the comments on existing posts, you'll need your MySQL database credentials. And a way to log on to your database, for example with phpMyAdmin or a mysql command-line interface. Turn to your hosting provider for more information and details. Once logged on to your MySQL database, through phpMyAdmin, click the WordPress wp_posts table on the left. We're looking for the column called comment_status. The comment_status column will probably have the value "open" for posts, and we need to set that to "closed". Here's how:

Click the SQL tab in phpMyAdmin, and copy/paste the next MySQL statement in it:

UPDATE `wp_posts`  SET `comment_status` = "closed"  WHERE `comment_status` = "open";

Don't forget to change the wp_ table prefix to reflect your database situation.

WordPress comments enabled on individual posts

Now the WordPress comments are closed (disabled) for all your posts, spammers can no longer abuse your blog to spread their junk. If you want to enable comments on individual and/or new posts, there is a little Discussion setting in the Add New Post and Edit Post sections. Check the option check boxes you want to enable.

Enable WordPress comments for individual posts
Enable WordPress comments for individual posts

Re-enable WordPress comments globally

If you have disabled the WordPress comments globally for all posts, you can use the following MySQL query to re-enable the comments for all published posts:

UPDATE `wp_posts`  SET `comment_status` = "open"  WHERE `comment_status` = "closed"  AND `post_status` = "publish";

Captcha protection for WordPress comments, or block comment spammers

Another option is to secure WordPress comments with a captcha. There are a lot of captcha plugins for WordPress, just check the plugins directory. Of course, once can also manually block WordPress comment spammers.

Cloudflare Turnstile, a free tool to replace CAPTCHAs

WP Pagebuilders has a nice how-to about integrating Cloudflare Turnstile without a plugin, directly in your theme functions.php file: How to Add Cloudflare Turnstile to WordPress Comment Without Plugin. I've used this post to integrate Cloudflare Turnstile into my WordPress blog.

Donate a cup of coffee
Donate a cup of coffee

Thank you very much! <3 ❤️

1 Comment

  1. great tutorial. I used for my site this method and this really work

Comments are closed