How to disable comments in WordPress?

Rating
4.8/5

Are you getting lots of spammy comments? Is it frustrating for you? Do you want to know how to disable comments in WordPress? In this article, we have got everything covered on how to disable comments in WordPress.

Comments can enrich your blog or website in many ways, as it one of the best ways to interact with your website visitor, can help to build a community, and can also provide your website some SEO benefits. Letting your website visitors share their thoughts through comments can increase your website’s user engagement. 

But generally, the maximum number of comments are either self-promotional or spammy, and not every website needs or gets benefit from comments sections. So, there are lots of websites that want to disable the comments section from their WordPress website. And this is really a big issue for any website that gets tons of comments just within a week. 

Another reason for disabling comments on the WordPress website is to improve the website loading speed. There are several websites that provide really long and in-depth articles on the blog, and as you know long content means increase in website load time.

Similarly, if you don’t have any blog or if your website is focused only on providing information with some static pages, it’s better to disable your comments section from the website. So, as you can see their several website owners that may opt to disable comments in their WordPress websites.

Whatever the reason may be, if you want to disable your comments and remove the comment section from your WordPress website, we are here to help you out. There are several options that can let you disable comments in your WordPress site, let’s start from the easiest one and then go in-depth.

How to Disable Comments in WordPress for the future post using the built-in option?

Disable comments in WordPress for future post - How to disable comments in wordpress - Blog Haveli
Disable comments in WordPress for future post – How to disable comments in wordpress – Blog Haveli

If you have just started a brand-new WordPress website, then it is to disable comments on your WordPress website. Just hover the “Setting” tab that you can find in the left sidebar of your WordPress dashboard and then click on the “Discussion” option.

Discussion Tab - How to disable comments in wordpress - Blog Haveli
Discussion Tab – How to disable comments in wordpress – Blog Haveli

Now after you come to the Discussion Setting Page, untick the checkbox that says “Allow people to submit comments on new posts”. Then scroll down to the bottom of the page and click on the “Save Changes” button to save your settings.

Once you disable comments on new posts, your comment section for all your future posts will be closed and nobody will be able to comment on anything.

But this method has few drawbacks, first, if your website is older and has commented with your existing post, it will not be able to remove it from your website. And secondly, it will not disable the comment section in your existing post.

How to disable comments in WordPress after a certain period of time?

Disable comments in WordPress after a certain period of time - How to disable comments in wordpress - Blog Haveli
Disable comments in WordPress after a certain period of time – How to disable comments in wordpress – Blog Haveli

WordPress also provides an option where you can automatically close your comments section after a certain period of time. For example, you can keep your comment section enable for all of your new posts up to 15 days or 30 days from the date article has been published. And after that specific day, the comments section will get automatically disabled.

All the settings related to comments can be found on the Discussion page under the Setting tab of your WordPress dashboard sidebar. So, you need to go to the Discussion Setting Page, enable the “Automatically close comments on posts older than __ days” option, and provide the number of days you want to keep the comments section enable.

By default, the number of days is kept 14, you can change it just by putting your required days in the textbox (in place of 14) and then hit the “Save Changes” button.

So, for example: if you have selected 30 days then whenever you publish a new post, the comment section of that particular post will be enabled for 30 days only. And after 30 days, the comment section will be automatically disabled and no one will be able to comment on that post anymore.

How to Disable Comments in WordPress Globally using the built-in option?

As you can see in the above section that by disabling the “Allow people to submit comments on new posts” option you can only disable comments in your future or new post. But what about the existing post, can’t we disable the comments for an existing post?

Of course, we can disable comments for our existing post too. For that, you need to follow the same process that we have discussed in the previous section, but before hitting the “Save Changes” button you need to do one more step.

So, after you have unticked the checkbox that says “Allow people to submit comments on new posts”, scroll down a little further, where you can see “Automatically close comments on posts older than __ days”. Now, tick the checkbox in front of this line and in the number of days put 0 and then hit the “Save Changes” button.

Disable comments in WordPress after a certain period of time - How to disable comments in wordpress - Blog Haveli
Automatically close comments on posts older than __ days – How to disable comments in wordpress – Blog Haveli

After saving all your changes, your comments section will be disabled in all of your posts – for the future post as well as the existing post. Now, the last step: you need to go to the comment section and manually delete all your existing comments.

For that, click on the “Comment” option from the sidebar of your WordPress dashboard and open the comment area. Now select all the comments and from the “Bulk Action” option select “Move to Trash”. Then finally click on the “Apply” button to remove all your comments from your WordPress website.

How to Disable Comments in WordPress on a Specific Page or Post

Sub-menu for specific post - How to disable comments in wordpress - Blog Haveli
Sub-menu for specific post – How to disable comments in wordpress – Blog Haveli

By default, WordPress has disabled comments on all the pages and have kept enable for all of its posts, because generally, pages don’t require comment section. But if you want to alter this setting and you can make your own custom rule, WordPress has given you the freedom to enable or disable comments on a specific page or post according to your needs.

This time the process is a little different compared to the previous sections. So, if you want to disable comments in WordPress for a specific page or post, then first you need to open that particular post or page.

For example: if you want to disable the comment of a specific page, then go to “Pages” and click on “All Pages”. Or if you want to disable comment of a specific post, then go to “Posts” and click on “All Posts”.

Sub-menu for specific page - How to disable comments in wordpress - Blog Haveli
Sub-menu for specific page – How to disable comments in wordpress – Blog Haveli

Now, you need to hover your mouse on that particular “Page Title or “Post Title” and you can see a set of options appearing beneath the title of that post or page. You need to click the Edit option from the sub-menu that has appeared after hovering the title.

After the page or the post opens, you need to click on 3 vertical dots which you can find on the top-right corner. Once you click on the 3 vertical dots a drop-down will appear, scroll down to the end of the drop-down menu, and click on the “Options”.

Sub-menu for specific post or pages - How to disable comments in wordpress - Blog Haveli
Sub-menu for specific post or pages – How to disable comments in wordpress – Blog Haveli

You will get a popup menu once you click the “Options” tab, in this popup menu you need to make sure that the “Discussion box” is checked or enabled. This will let you enable or disable the comments section for a specific page or post directly from the Document Tab.

Popup menu for specific posts & pages - How to disable comments in wordpress - Blog Haveli
Popup menu for specific posts & pages – How to disable comments in wordpress – Blog Haveli

This will give you a new option in the “Document Tab”, named as “Discussion” and once you expand the Discussion option, you will find a checkbox with an option to “Allow comments”. So now, just by selecting the “Allow comments” checkbox, you will be able to enable or disable the comment section for that specific page or post.

Allow comments for specific posts & pages - How to disable comments in wordpress - Blog Haveli
Allow comments for specific posts & pages – How to disable comments in wordpress – Blog Haveli

How to Disable Comments in WordPress for Pages and Posts in Bulk

What if you have to disable comments for more than one page or post? Suppose, you have 50 posts and you want to disable comments for 30 specific posts, then what should you do?

Disabling comments page by page or post by post is a time taking process, so thinking of that WordPress has provided an option that lets you disable bulk comments in a single go.

So, if you want to disable comments for pages or posts in bulk, then first you need to click on pages or posts from the sidebar of your WordPress dashboard and you will land on a section where you can see all your pages or posts.

Disable Comments in WordPress for Pages and Posts in Bulk - How to disable comments in wordpress - Blog Haveli
Disable Comments in WordPress for Pages and Posts in Bulk – How to disable comments in wordpress – Blog Haveli

Now, by clicking on the checkboxes, select the pages or post where you want to disable your comments section. After selecting your required posts or pages, click on the “Edit” option from the Bulk Actions dropdown box, and click on the “Apply” button next to it.

This time you can see a new section where you can perform bulk actions including changing the author name, status, format, and of course, turning off comments for all the selected posts.

Settings to Disable Comments in WordPress for Pages and Posts in Bulk - How to disable comments in wordpress - Blog Haveli
Settings to Disable Comments in WordPress for Pages and Posts in Bulk – How to disable comments in wordpress – Blog Haveli

Whereas in the page section you will get option to change author name, parent page, status and comments.

After making you required changes click on the “Update” button to save all your changes.

How to Disable Comments on Media

When you upload any image, video, or some other media file to your WordPress site, an attachment file is created. So, your visitors can still comment on your media attachment page, although you have already disabled comments on all of your pages and post.

You can disable your comments on media files in two ways, one using a plugin and another one is just by adding a few lines of code in your WordPress function.php file. Don’t worry it is a simple process, just hover on the “Appearance” tab from the sidebar of your WordPress dashboard and click on the “Theme Editor”.

Disable comments in media file - How to disable comments in wordpress - Blog Haveli
Disable comments in media file – How to disable comments in wordpress – Blog Haveli

Then, from the “Select theme to edit:” dropdown menu select your current theme and click on its function.php file. Then you need to add the following code as shown in the image.

//  Disable Comments on Media  files 
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 ); 

This code will automatically disable your comments section from all of your media files. And now you need to finally hit the “Update File” button at the bottom of the page to save your all settings.

How to Disable Comments in WordPress by inserting code?

If you have a little bit of technical knowledge then you can add a small piece of code in the function.php file of your current theme to disable comments from your WordPress website. Just hover on the “Appearance” tab and click on the “Theme Editor” option.

Now you need to select your current theme from the “Select theme to edit:” dropdown menu and then select your function.php file. Finally, you need to add the following code in your function.php file:

// Disable support for comments and trackbacks from 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' ) ) { 
            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 all comments from 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 your 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 from the 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 who is trying to access your comments page. 
function df_disable_comments_admin_menu_redirect() { 
    global $pagenow; 
    if ( 'edit-comments.php' === $pagenow ) { 
        wp_redirect( admin_url() ); 
        exit; 
    } 
} 
add_action( 'admin_init', 'df_disable_comments_admin_menu_redirect' ); 
// Remove comments metabox from your 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 the 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' ); 

How to Remove “Comments are closed” in WordPress?

Disable comments closed - How to disable comments in wordpress - Blog Haveli
Disable comments closed – How to disable comments in wordpress – Blog Haveli

Sometimes you might also face somewhere your website might display “Comments are closed” in your comments section. This kind of problem is easy to solve, firstly log-in to your web hosting and navigate to your root folder.

Now, go to the “wp-content” folder and then open your themes folder, then you need to open your current theme folder and rename the “comments.php” file. Just for an instant, rename it to “old_comments.php” file, after that you need to create a new file and name it as “comments.php”. That’s it, this simple trick can remove “Comments are closed” issue from your WordPress website.

How to Disable Comments Using a WordPress Plugin?

If you don’t want to apply the above-mentioned process to disable comments in WordPress and wonder if there is a plugin that can solve all your issues just by a few clicks of your mouse. Then don’t worry, we have got that covered too; there is a free plugin that can be just the perfect fit.

Disable Comments developed by Samir Shah is a free WordPress plugin that has the ability to disable all your comments on your WordPress website. The plugin is easy to use and allows administrators to globally disable their comments section on any post, pages, attachments, etc. It can also remove all comment-related fields from edit and quick-edit screens of your WordPress.

Some of the features of Disable Comments WordPress plugin:

  • All “Comments” links are hidden from the Admin Menu and Admin Bar
  • All comment-related sections (“Recent Comments”, “Discussion” etc.) are hidden from the WordPress Dashboard
  • All comment-related widgets are disabled (so your theme cannot use them)
  • The “Discussion” settings page is hidden
  • All comment RSS/Atom feeds are disabled (and requests for these will be redirected to the parent post)
  • The X-Pingback HTTP header is removed from all pages
  • Outgoing pingbacks are disabled
  • Define DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE and set it to false to prevent the plugin from replacing the theme’s comment template with an empty one
  • Define DISABLE_COMMENTS_ALLOW_DISCUSSION_SETTINGS and set it to true to prevent the plugin from hiding the Discussion settings page

Conclusion

You can also check the solution to some of the common errors of WordPress like ERR_TOO_MANY_REDIRECTSBriefly unavailable for scheduled maintenance. Check back in a minuteError Establishing a Database Connection.

We hope this article has fulfilled your query and has helped you to disable comments on the WordPress website. We have tried to provide you in-depth knowledge on how to disable comments in WordPress and if you still have any other queries or suggestions please feel free to contact us.

Please share this post in social networks, if you think this article can help others to archive their goals.

Thanks in advance.

Table of Contents

Let Us Build Your
Dream Project

Let Us Build Your
Dream Project

Let Schedule a Meeting