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.
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.
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?)
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.
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 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.
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.
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";