How to disable WordPress comments

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 tens- or hundreds of thousands spam reactions, disabling WordPress comments – and removing – is the only way to go. Here is how to disable WordPress comments in both the WordPress Dashboard interface and in your MySQL database.

Disable WordPress comments through Discussion Settings #

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.

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.

(Did you know you can use MySQL’s power to clean up WordPress spam too?)

Disable WordPress comments through MySQL/phpMyAdmin #

As said, you cannot close comments on existing posts through the WordPress Dashboard. Unless you want to edit all your posts… Therefor, we’ll use the power of MySQL, just to make life a bit easier.

This may interest you:   Remove Jetpack email sharing service

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. Just follow my post Secure WordPress with a Captcha for a how-to. Of course, once can also manually block WordPress comment spammers.

This may interest you:   Quiet WordPress 4.7 RC2 available

Show your support

If you want to step in to help me cover the costs for running this website, that would be awesome. Just use this link to donate a cup of coffee ($5 USD for example). And please share the love and help others make use of this website. Thank you very much!

About the Author Jan Reilink

My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization.

follow me on:

Leave a Reply

1 Comment on "How to disable WordPress comments"

newest oldest most voted
Notify of
M. Awais

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