how to disable comments from posts and pages in wordpress

WordPress is one of the most popular blogging framework that is used by many different sites. Commenting is often an essential part of blogs and is a feature that is built into the WordPress framework. But many a times you might want to disable comments on a blog post, a specific page or the entire site. There could be any number of varied reasons for this…

  • Old Posts: Posts are pretty old and are not relevant any more. You want to reduce the workload and monitor only comments on the latest posts.
  • Controversial or Irrelevant Comments: Sometimes the comments can get really out of hand, because of spamming or relevancy.
  • Spam Overload: Prevent spamming on your older posts that are not really active.

Whatever the reason, the process or steps to disable comments is mostly well documented in WordPress.

disable comments site wide

You can disable all the comments across the site by default, such that no comments can be posted to any of your new content.

  1. Go into the WordPress Administration UI (Ex: http://website/blog/wp-admin)
    disable comments from pages and posts
  2. Click on Settings
  3. Click on Discussion to open the Discussion Settings panel
  4. Under Default Article Settings, Uncheck the option Allow people to post comments on new articles
  5. Optionally, you can uncheck all the options under Other Comment Settings section
  6. Scroll down and click Save Changes to save settings

This will disable the support for comments on all the new content that you will be posting. If you already have a site where comments were allowed, then you will need to disable commenting on each of those existing posts separately or individually.

This is usually a big pain, but let’s see how you can disable comments on per post basis.

disable comments on a post

Sometimes you just want to disable comments on a single post or you want the ability to disable comments on a post when you publish it. Turning off comments by default may not be an option. In that case,

  1. Go into Edit mode for the post that you want to change the option
  2. Scroll down towards the bottom of the edit page to find a section/module called Discussion
  3. Expand the module by clicking on it
  4. Uncheck the option Allow Comments
  5. Optionally, also uncheck the option to Allow trackbacks and pingbacks
  6. Scroll back up and click on Update button in the Publish module to save the settings

In case, you do not find the Discussion module (it is different from the Comments module, yeah…it is confusing), it might be disabled in the screen options.

  1. Click on Screen Options in the upper right hand corner of the edit page
  2. This will drop down to expose several options to configure the screen layout
  3. Make sure that the option Discussion is selected and has a check box next to it.

Depending on the theme that is used, if you cannot find the option to turn off comments in the Edit interface also check the Quick Edit interface to see if it can be turned off from there.

disable comments on all or multiple posts

If you need to disable comments on multiple posts on the website, then going into each and every post one after the other is probably not a very efficient method.

  1. In the Admin UI, click on Posts and then click on All Posts
  2. Select all the posts that you want to disable the comments
  3. Pull down the drop down menu that says Bulk Actions and select Edit
  4. Click Apply
  5. A set of options are shown that includes Comments and Pings
  6. Select the Do not Allow option from the dropdown for Comments
  7. Optionally, also select the Do not Allow option for Pings
  8. Click Update button to save the settings
Wordpress disable comments in posts

disable comments based on time

Another option you have is to set a time limit on the blog posts for comments. You can choose to disable comments on older posts, especially if they are time sensitive topics. This option is available as a global option applied to all posts.

  1. In the Admin UI, Click on the Settings
  2. Click on Discussion to open the Discussion Settings panel
  3. In the Other Comments Settings section, select the option that says Automatically close comments on articles older than
  4. Enter the number of days that you want the comments to remain enabled after publish in the text box next to it
  5. Scroll down and click on Save Changes

disable comments on a page

You can disable comments on pages just the same as you would on blog posts. You can edit existing pages to turn off comments or disable commenting for both posts and pages globally as described in the first section. Just in case you cannot find the option to turn off comments in the Edit interface, also check the Quick Edit interface.

Unfortunately, there is no separate options to handle pages and posts differently by default. You cannot disable comments for pages by default while keeping it turned on for posts. Usually, you will have only a few static pages so you should be able to turn them off on an individual basis.

Again, depending on the theme used you might have an option to disable comments in pages only in the theme settings. The theme I use on this blog does have the option to disable Page comments and Post comments separately. Be sure to check your theme options.

Another option is to remove the code that displays the comments from the template that displays the page. Open the file named page.php (Page Template) in your theme and look for the code that displays the comments. It is usually some variation of the following :

<?php comments_template(); ?>

or

<?php comments_template( '', true ); ?>

Remove or comment that code out from the page template file to disable commenting only on pages. Be sure to test the page after removing the code to make sure that nothing is broken.

disable comments using plugins

There are some plugins that you can use to achieve the above functionality, sometimes over and above what is provided by WordPress. Some of the noteworthy plugins are

  • Disable Comments: This plugin allows you to completely disable all comments across all pages, attachments, and posts. This is not for you if you want to selectively disable comments.
  • No Page Comment: Another plugin which allows you to selectively disable page comments and comments on some custom blog posts.

After enabling/disabling and removing codes, be sure to purge your cache (if you do use any kind of WordPress Cache) and test to make sure that the options and the pages are working correctly.