Enable or Disable WordPress Comments on all posts in one step

With WordPress, you can globally disable comments, if you do not want to allow comments to be placed on your blog. Since this information is stored in the database, we can edit the allow comments option (open or close comments) across the entire blog in one step. This tutorial explains how to remove all instances of Allow Comments by using an SQL database query.

Note: The following tutorial assumes that you are using WordPress 2.5 or beyond and have access to phpMyAdmin to access your database.

The Process:

1. First you need to log into your phpMyAdmin control applet

2. Now locate and select your WordPress database on the left from the database dropdown list

3. Now select the SQL tab from the navigation tabs at the top

4. Within the Run SQL Query box add the following code and click go:

UPDATE posts p SET comment_status = 'closed', ping_status = 'closed' WHERE comment_status = 'open';

5. If you get an error, check your wp_post prefix from the database list and change the code to match accordingly

If successful, you should have disabled the ability to comment on your posts across your entire blog.

To globally enable or re-enable comments, simply use the following code:

UPDATE posts p SET comment_status = 'open', ping_status = 'open' WHERE comment_status = 'closed';