How to disable all comments in WordPress

Lately I’ve been getting a lot of comment spam from my sites, including this one! While I do enjoy legitimate comments it’s just too much to manage at some point and that’s when discussion management comes into play. There are lots of options out there, I’ve chosen to completely remove the ability for people to comment on my posts and here’s how I did it.

First of all, in WordPress you can disable future commenting by going into Settings > Discussion and then unchecking the “Allow people to post comments on new articles” option, but what about older posts? The ones that already have comments open and are not controlled in the Discussion area.

Older posts in WordPress may have the “Discussion > Allow comments.” checkbox filled and this overrides the site wide preferences described above. You can certainly manually edit this option in each one of your posts but that takes forever, even using the “quick edit” feature on the Posts list page can be quite tedious if you have hundreds of stories.

To save time and energy I suggest directly editing your MySQL database to turn discussion and commenting off in all of your stories. It may sound daunting if you’ve never edited your database but it’s actually not that hard. Here are the steps:

  1. Backup your database, should be an obvious and easy feature in your hosting area
  2. Launch your MySQL database by clicking something like “Manage via phpMyAdmin”
  3. Click the database name, usually the second link there below “information_schema”
  4. Now on the right side click the “SQL” tab
  5. You’ll see a big input field labeled “Run SQL query/queries on database”
  6. Enter the command UPDATE wp_posts SET comment_status = 'closed' and click Go
  7. You can also enter the command UPDATE wp_posts SET ping_status = 'closed' to turn off trackbacks for individual entries

That’s it! You can always reverse this by using SET comment_status = ‘open’ at a later time. This is way faster than manually doing it and totally effective for cutting down spam. Here’s another article with more details on this topic and some great resources. Good luck!