How to Disable Comments in WordPress

I remember the very first comment I received on a blog post that I wrote a few years ago; I was over the moon. It was my first comment on my very first blog post for crying out loud! A very big deal, I’m sure you will all agree on :) The comment turned out to be spam though…I know we’ve all been there. Comments on your WordPress site serve a very special purpose – they tell you how engaged your readers are and which kind of content really matters to them. Sometimes having comments enabled on your WordPress site could turn out to be a pain in the neck too. The reasons to disable comments on your WordPress website can vary from too much spam, unwanted criticism or even abuse. Find out how to disable comments in WordPress to avoid spammy content on your blog post/ page.

Should you disable comments?

Honestly speaking comments are not required for every niche/article. You might have a site where comments don’t come into play at all. Imagine having a comments section on a newspaper for each and every article; not the best place, right? So, you should think about your niche and consider enabling/disabling comments.

Where exactly can users comment in WordPress?

Comments in WordPress can be made on posts, pages and even the media you upload. Yes, once a media file is uploaded to your WordPress site it automatically creates an attachment page. Let’s see how to disable comments along with its relatives – pingbacks and trackbacks on existing posts, pages, and media.

There are two options to disable comments and both of them are actually part of the WordPress itself. Please see the screenshots:

This is how you disable the comments on the whole site.

Disable comments for the whole website - Discussion Settings WordPress Theme

When pages/post are created and comments were not closed at the time of creation, to close them Discussion > Settings will not work, you will need to disable them individually on each page. Once again, this is something we all forget and it will be the same for every Theme.

This is for disabling comments on a single page.

Disable comment on a single WordPress post or page

 

How To Disable Comments on Existing Posts and Pages

Imagine you have five existing posts on which you no longer wish to receive comments. You can make changes to these individually, but what if you have dozens, hundreds or thousands of blog posts? Now bulk edits in WordPress come handy. Go to WordPress Dashboard > Posts. Follow the steps to make changes to the comments, pingbacks and trackbacks options on existing posts.

1. To select all posts on the screen, check the checkbox next to the Title label. If you prefer to bulk edit only certain posts, then check only the individual posts.

2. Click the down-arrow next to Bulk Actions, and choose Edit.

Bulk edit posts in WordPress

3. Click Apply. A Bulk Edit section appears with a limited set of settings available.

Bulk edit posts for comments and pingbacks

  • Click the down-arrow next to Comments and select Do not allow.
  • Click the down-arrow next to Pings and select Do not allow.
  • Click Update to save these changes.

4. There you go, you have disabled comments and pingbacks on posts successfully. The same steps apply for bulk editing pages.

5. You can also disable comments on posts after a certain number of days. For this head over to WordPress Dashboard > Settings > Discussion and Other comments settings section. Check the Automatically close comments on articles older than x days option and specify the number of days. Remember this works if you have comments enabled on your WordPress site.

Discussion settings - other comments settings

How To Disable Comments On Media Attachments

Each media file uploaded on your WordPress site automatically creates an attachment page even if it is not used on any post/page. When viewed on the front-end the attachment page will contain a comment form (only if you have comments enabled on your WordPress site).

Media Attachment Page details

Unfortunately, you cannot bulk edit media files. You have to edit them individually. Like posts/pages, media attachments will contain a Discussion section where you can make changes to the Allow comments and Allow trackbacks and pingbacks on this item options. Just uncheck these options to disable them and Save the changes.

Have loads of media files? Here’s a simple code that you can use. This code goes in your Themes Functions (function.php) file. Make sure you back it up locally before making any changes. After backing up the functions.php file located within yourdomainname.com/wordpress/wp-content/themes/your-theme-folder/ go to WordPress Dashboard > Appearance > Editor and locate the Theme Functions (functions.php) file. Click on it to start editing it. Paste the following code just after the last line and click Update File button:

function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == 'attachment' ) {
return false;
}
return $open;
}
add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );

Note: It is advised to create a child theme if you intend to make any changes to your theme. So the modifications are not overwritten even when you update the theme.

A little piece of advice

If you have just launched your WordPress site, then it makes sense to disable comments in WordPress right from the very beginning. Believe me; it’ll save you the tedious task of bulk edits on pages, posts, and media. After installing WordPress go to WordPress Dashboard > Settings > Discussion.

Discussion settings - Default

Uncheck the Allow link notifications from other blogs (pingbacks and trackbacks) on new articles and Allow people to post comments on new articles options under the Default article settings section. Don’t forget to click on the Save Changes button to save the settings.

The quick fix – Disable Comments Plugin

A single step solution to save you the trouble of bulk edits –  Disable Comments Plugin.

Disable Comments Plugin - Single step solution to disable comments in WordPress

With over 900,000+ active installs and a 4.9 stars rating, the Disable Comments plugin enables administrators to globally disable comments on any post type (posts, pages, attachments, etc.). The plugin is multisite friendly, removes comment-related items from the Dashboard, Widgets, Admin Menu and the Admin Bar. Remember the settings cannot be overridden for individual posts if you have activated the Disable Comments plugin.

All set to disable comments in WordPress? Have your own tricks/plugin suggestions on how to disable comments? Leave us your comments below.

About the Author

Preeti is a freelance content writer for hire. She loves taking WordPress plugins & themes for a spin for reviews & technical writing. Get in touch with her on LinkedIn or Twitter.

4 Comments
  • Roy says:

    If I have unchecked the two allow boxes in the discussions settings, why would I want/need the Disable Comments Plugin?

    • Preeti Whatkar says:

      Hi Roy,

      Even if you have unchecked the two boxes in the Discussion settings, you can still override those two options (i.e. Comments, Pingbacks, and trackbacks) for individual posts/pages. WordPress allows it.

      The Disable Comments plugin, however, ‘globally’ disables the comments. You will not see the Comments and Pings drop-down lists on the Edit & Bulk edit box. Also, the Discussion tab checkbox in the Screen Options will be removed. Hence you cannot override the discussion settings even if you have unchecked the two boxes.

      Hope this solves your doubt.

      Cheers,
      Preeti

  • Srinivas P says:

    You have really made by day, I was struggling to enable the comments for my posts, was checking all the code and was wondering why the status is saying closed for comments even if I have enabled all at database level and even in the comments_open function , I have forcefully assigned but still was unable to get it through.

    It was so silly I had gone to the settings > discussions pages several times in this process of enabling, but my eyes did not catch this setting :) to close the comments for the posts older than certain number of days :) got triggered only after started searching for how to set number of days in order to automatically close the comments..

    thanks for your post here and appreciate your help :)

  • I have literally had to spend 30 minutes deleting posts from the comment inbox before. I just opt to disable comments most often now. I wish WP would create a ” delete all” setting!

Leave a Reply

Your email address will not be published. Required fields are marked *