wordpress disable comments

How To Disable Comments on WordPress – 3 Easy Methods

wordpress disable comments

If you are looking how to disable WordPress comments we got you covered. Comments are an integral part of the WordPress experience. It’s a way for your site visitors to give their thoughts on your content and engage them to interact with the site. The search engines index the comments as well, so they can slightly improve your SEO.

So why are we exploring different ways to disable them? Good question. The answer – comments can be problematic. Or simply unnecessary. For example, you don’t need comments on your ‘About’ or ‘Contact Us’ page. Some other undesirable aspects can be spam, trolls, phishing attempts, self-promotion, etc.

The good news is that you can disable WordPress comments easily and even partially if necessary. For instance, you can choose to disable comments on pages, posts, attachments, custom post types or even just a selected few pages or posts. Depending on what do you want to achieve, you can use different approaches.

Comments can be disabled:

1. Disabling comments through wp-admin dashboard

As mentioned before, there are different approaches based on what you want to achieve. The general comment settings are located under Settings -> Discussion in wp-admin dashboard. This is where you want to start with your changes.

Disable WordPress comments on any future posts

If you just recently published your WordPress site and don’t want to allow comments, you just need to uncheck the option ‘Allow people to post comments on new articles’. This setting can be overridden on any individual post in case you want to make an exception.

Closing comments after a certain period of time

There is an option called ‘Automatically close comments on articles older than __ days’. You might want to change the default time (which is 14 days) to another number. You can also use this to close comments on all existing posts and pages by setting the value to 0. This will not remove the comments, just prevent any visitors from posting any comments on existing pages and posts.

If you want to remove all existing comments through the wp-admin dashboard, navigate to ‘Comments’ section. Select all the comments and move them to trash.

If you have a lot of comments you might have to repeat this process a few times. Depending on the number of comments, this can be a tiresome process. You can make it easier by increasing the number of comments per page (this applies to backend only). The default setting is 20 and it can be changed by clicking on ‘Screen options’ and changing the number (I advise no more than 100 to avoid timeouts and errors).

If you have thousands or tens of thousands of comments, it is better to use a plugin to do this (more on this later).

Disable comments only on certain pages/posts

If you want to disable comments on only some of the posts or pages on your site, navigate to posts/pages section. When you hover over a certain post or page in the list some options will appear, among which will be the ‘Quick edit’ option. After you click on it, find the ‘Allow Comments’ checkbox and uncheck it.

Use Bulk action to disable comments on multiple pages at once

This solution follows the same principle as the one mentioned before, but it can save you some time. Go to ‘Posts’ in wp-admin dashboard, select the posts you want to edit in a bulk, and select ‘Edit’ from ‘Bulk Actions’.  Click ‘Apply’.

Go to the ‘Comments’ setting, choose ‘Do not allow’ from the dropdown and click ‘Update’. If you want to display more pages or posts in the list, use the ‘Screen Options’ to increase the number of items per page in the backend.

Again, if you have been running the site for some time and have a lot of posts or pages, you might want to consider doing this with a plugin.

Disable WordPress comments on media files

Whenever you add an image, video or some other media file to your WordPress site, it is stored in the database as a post. It doesn’t matter if you’ve added it as a featured image or directly to the media library, this is how WordPress sees it. That means that even if you disable comments on the page, your visitors can still add comments to the media attachment page.

Theoretically, you can change this setting on each image one by one, but that is very time-consuming. Also, the media files don’t have a Bulk Edit action. Therefore, I suggest disabling comments either by using a plugin or by adding this to your theme’s functions.php file:

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 );

2. Disabling comments with a plugin

Use the ‘Disable comments’ plugin

A simple name for a plugin and it does just what it says. It is one of the best-rated plugins with over 1 million active installs. The important thing to note is that this plugin does not allow to enable comments on individual pages. It does remove comments, but it also removes any comment related settings from edit and quick-edit screens.

It will, however, let you disable comments on only certain post types, but that cannot be overridden for individual posts/pages.

Regardless of being one of the best-rated plugins, it does not declare support for WordPress after version 5.1.1. It doesn’t mean that it won’t work, but it is something to keep an eye out for.

‘Disable Comments + Delete Comments’ plugin

This plugin is not as popular is its competitor, but it is rated very good, it is updated regularly and it declares the support for the latest WordPress core release. When it comes to disabling comments, it does pretty much the same thing the ‘Disable Comments’ plugin does and it offers similar options.

There is however one big difference. This plugin lets you DELETE comments as well. It is a handsome feature added in a recent version. If you have a problem with a lot of spam comments, then this is your all-in-one solution.

So far nobody reported major bugs or problems. The number of active installs since it was published is just over 2000, which fades in comparison to its competitor which has 1 million. Still, it is an option to consider.

Use ‘Akismet Anti-Spam’

Now, this plugin is not actually something you can use to disable comments. The reason why it made it to the list is that you might have an issue with spammers but don’t want to be bullied into disabling comments as a solution.

One of the greatest things about this plugin is that it automatically detects spam comments. It does so by checking comments against the global database of spam and filters the suspicious ones.This is a plugin with a great reputation and it is developed by ‘Automattic’ – a company that develops WordPress.

It is important to know that it requires an API key to work. You can obtain the API key here. It is free for personal blogs, while paid subscriptions are available for business sites.

Use captcha to prevent spam

Another method you can try out is using Google reCAPTCHA to prevent bots from spamming your site. You will need a plugin to integrate the reCAPTCHA with your comment forms. One of the best solutions is ‘reCAPTCHA in WP Comments Form’ plugin.

In order to use it, you will have to generate the reCAPTCHA keys. This is a simple process which requires a Gmail address and the plugin actually has an installation wizard which will guide you through the process.

3. Insert code to disable comments

The final method covered in this article is disabling comments by inserting code to your theme files. Depending on your knowledge, this may or may not be challenging. All you need to do is to paste this code at the bottom of your active theme’s functions.php file:


// Add to existing function.php file

// Disable support for comments and trackbacks in post types

function df_disable_comments_post_types_support() {

$post_types = get_post_types();

foreach ($post_types as $post_type) {

if(post_type_supports($post_type, 'comments')) {<c/ode>

remove_post_type_support($post_type, 'comments');

remove_post_type_support($post_type, 'trackbacks'); } } }

add_action('admin_init', 'df_disable_comments_post_types_support');

// Close comments on the front-end

function df_disable_comments_status() {

return false; }

add_filter('comments_open', 'df_disable_comments_status', 20, 2);

add_filter('pings_open', 'df_disable_comments_status', 20, 2);

// Hide existing comments

function df_disable_comments_hide_existing_comments($comments) {

$comments = array();

return $comments; }

add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);

// Remove comments page in menu

function df_disable_comments_admin_menu() {

remove_menu_page('edit-comments.php'); }

add_action('admin_menu', 'df_disable_comments_admin_menu');

// Redirect any user trying to access comments page

function df_disable_comments_admin_menu_redirect() {

global $pagenow;

if ($pagenow === 'edit-comments.php') {

wp_redirect(admin_url()); exit; } }

add_action('admin_init', 'df_disable_comments_admin_menu_redirect');

// Remove comments metabox from dashboard

function df_disable_comments_dashboard() {

remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); }

add_action('admin_init', 'df_disable_comments_dashboard');

// Remove comments links from admin bar

function df_disable_comments_admin_bar() {

if (is_admin_bar_showing()) {

remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } }

add_action('init', 'df_disable_comments_admin_bar');

Disable Comments in WordPress – Conclusion

There are some advantages to using a code rather than installing a plugin. First of all, you will get pretty much the same functionality as you would get with a plugin, and second, you won’t have to actually install one. Piling up plugins on your WordPress site can make it slow, therefore, it is always a good idea not to add plugin if you don’t have to.

Still, you should approach this carefully. Not pasting the code properly, leaving out as much as a semi-colon or any similar mistake can cause fatal errors and bring the site down. This is not a reason for big concerns, but it may cause an inconvenience for your visitors.

This article will hopefully provide you with a solution that works best for your site. If you need any assistance, you can always reach out to our professional WordPress Support team. Be sure to check out our services. For more step by step WordPress tutorials follow our WordPress blog.