Enable/disable comments on all pages or posts at once

Posted on Jan 10, 2013 in WordPress | 2 comments

Have you ever wanted to turn on comments for all your pages at once? Or perhaps managing comments is too much of a pain, so you decide you want to disable comments for all of your WordPress blog posts easily.

Change Posts Individually

The most obvious way is, when editing a page or post, to scroll down to the “Discussion” section and check or uncheck the “Allow comments” box.

Don’t see the “discussion” section on the page/post edit screen? At the top of the screen on the right side there is a “Screen Options” button. Click it and check the box for “Discussion” to make those settings visible.

Change a Group of Posts or Pages

When on the Pages admin screen or the Posts admin screen listing your articles, check the boxes to select which ones you want to change (or click the checkbox at the top of the table next to “Title”), then select “Edit” from the “Bulk Actions” drop down menu and click “Apply.” You will have a “Comments” drop down, among others, where you can select to allow or disallow comments and then click the blue “update” button in the lower right.

This is very handy for efficiently changing that on a set of specific posts, but if you want to change all of your posts or pages, changing them 20 at a time can get frustrating.

Change comment status for all articles at the same time

It’s easier than you think to make this global change, but it does require that you are able to edit your database directly.

It’s very easy to break your site when you directly edit the database! Work on a test site first and make sure to backup your site before changing the database (of course, you should have automatic backups occurring regularly anyway). If you are not completely comfortable editing your database, find a professional to do it for you.

Go into phpMyAdmin and click the SQL tab. Then just copy and paste one of the following queries:

Enable comments on all Pages
UPDATE wp_posts SET comment_status = 'open' where post_type ='page';

Disable comments on all Pages
UPDATE wp_posts SET comment_status = 'closed' where post_type ='page';

Enable comments on all Posts
UPDATE wp_posts SET comment_status = 'open' where post_type ='post';

Disable comments on all Posts
UPDATE wp_posts SET comment_status = 'closed' where post_type ='post';

To change the setting for all of your new posts, make sure to go into Settings > Discussion and check or uncheck the “Allow people to post comments on new articles” box. The tips described above only change existing posts and not the default for new pages and posts.

2 Comments

  1. Thank you for explanatory narration.

  2. THX, saved me a lot of time and did the job well on my WordPress 4.5.3 Blog!

Submit a Comment

Manage your comment subscriptions