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 sitewide
You can disable all the comments across the site by default, such that no comments can be posted to any of your new content.
- Go into the WordPress Administration UI (Ex: http://website/blog/wp-admin)
- Click on Settings
- Click on Discussion to open the Discussion Settings panel
- Under Default Article Settings, Uncheck the option Allow people to post comments on new articles
- Optionally, you can uncheck all the options under Other Comment Settings section
- 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,
- Go into Edit mode for the post that you want to change the option
- Scroll down towards the bottom of the edit page to find a section/module called Discussion
- Expand the module by clicking on it
- Uncheck the option Allow Comments
- Optionally, also uncheck the option to Allow trackbacks and pingbacks
- 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.
- Click on Screen Options in the upper right hand corner of the edit page
- This will drop down to expose several options to configure the screen layout
- 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.
- In the Admin UI, click on Posts and then click on All Posts
- Select all the posts that you want to disable the comments
- Pull down the drop down menu that says Bulk Actions and select Edit
- Click Apply
- A set of options are shown that includes Comments and Pings
- Select the Do not Allow option from the dropdown for Comments
- Optionally, also select the Do not Allow option for Pings
- Click Update button to save the settings
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.
- In the Admin UI, Click on the Settings
- Click on Discussion to open the Discussion Settings panel
- In the Other Comments Settings section, select the option that says Automatically close comments on articles older than
- Enter the number of days that you want the comments to remain enabled after publish in the text box next to it
- 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(); ?>
<?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.