How to turn off comments in WordPress?

How to turn off comments in WordPress - CodeFlist

If you no longer need the comment feature in WordPress, then you should definitely know how to turn off comments in WordPress.

Why disable comments?

Whenever you create a new post or page in WordPress, if there is an option of comment the users will be able to interact with your content. It is understandable that you do not require people to comment on your page.

But, why would you close the comment feature in your posts?

As a new blogger, this question may bother you as the main motive of writing a blog is to rank the post and make users read your post. When the users read a post, they may like to discuss the post and that would be hard when the commenting is turned off.

There may be different reasons that encourage you to disable comments in WordPress.

Spam Comments

Comments need moderation before appearing in your post. Lots of spam comments come from the bots and malicious users that need to be removed time and again.

There are a lot of spam comments that contain vulnerable links that can collect credit card numbers, personal information, or even install viruses on your site. You also need to filter off-topic comment that appears on the blog.

Not Required

There are sites where a comment is not necessary at all. Suppose you are writing a post to announce something about your business then you do not need comment in such notices.

If you already have a forum where your users can interact with each other, then you may not need to enable comments in your blog posts. The comment can also be managed on social media.

Comments are also not necessary in the static pages of the site like about, contact us, homepage, etc.

No value

There is a belief in some site owners that it won’t provide any additional value to the site. If the comments do not reflect any website goal so it is better to turn them off as it requires regular time for moderation.

How to turn off comments in WordPress?

There are different ways to turn off comments. Have a look at some of them:

How to disable comments in WordPress in future posts?

First of all, let’s disable comments on all future posts. For this, go to Settings>Discussion in the admin dashboard.

How to turn off comments in WordPress in future posts
How to turn off comments in WordPress in future posts

Here in the Default Post settings, you need to uncheck the option Allow people to submit comments on new posts. Once you save the changes, your future posts will not have a comment section.

How to bulk edit comments in WordPress?

Unless you have changed the default WordPress settings, comments are disabled by default in pages.

For a specific post, Go to Posts>All Posts and select single, multiple, or all posts on that page by selecting the respective box and change the Bulk Actions on the top to Edit with the dropdown.

Select Posts to Edit Comments
Select Posts to Edit Comments

Once you click Apply button, you will see the bulk edit option where you will see the list of posts that you selected on the left side while you will see the comment section on the right side.

How to bulk edit comments in WordPress
How to bulk edit comments in WordPress

Use the dropdown present in the comment to change it to “Do not allow”. Click the Update button towards the bottom right side to apply the changes.

In a similar manner if you go to Pages>All Pages you will be able to change the comment settings of all the pages of your site.

How to disable comments in WordPress in an individual post or page?

Using the above option, you can bulk edit the comment feature in the post.

But, what if you want to close comments only on a single post or page?

First of all, go to Posts>All Posts

Edit the post that you want to change. After the post opens, you can look for the “Discussion” in the “Post Settings” on the right side.

How to disable comments in WordPress in individual post
How to disable comments in WordPress in an individual post

Make sure to uncheck “Allow comments” in the “Discussion” and update the post to apply the changes.

This is similar if you want to change the comment settings of a single page.

How to turn off comments in WordPress after few days of publishing post?

Did you know that even if you have comments enabled on your site, you can turn it off after few days?

To apply this setting, Go to Settings>Discussion

Check the option “Automatically close comments on posts older than a certain number of days”. You can keep the number of days manually in that field. When you apply these changes, the visitors will be able to comment on future posts for the number of days that you have specified after the post is live. Once it crosses that limit, the comments will be closed on that post.

How to turn off comments in WordPress after few days of publishing post
How to turn off comments in WordPress after few days of publishing

If you have turned on comments for X number of days, make sure to enable manual approval of comments on your post. To do this, check the box Comment must be manually approved that is present on the same page Settings>Discussion inside the settings “Before a comment appears”.

How to disable comments in WordPress Media Files?

To turn off comments on the media file, you must choose the media file from Media>Library. Like in the above methods, uncheck the Allow Comments in the discussion field.

But, you will have to turn off comments on all media files individually by this method so this will be time-consuming if your site has a lot of media files.

To make it applicable on all media files, you can copy the below code in the function.php file on your theme.

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

How to turn off comments in WordPress in the theme editor?

There is also a way to disable comments with custom code just like the above method.

For this, you need to edit the page.php and single.php files in your theme.

While you are logged in to the admin dashboard, Go to Appearance>Theme Editor and select the active theme. You will see page.php and single.php files on the right side.

How to disable comments in WordPress in the theme editor
How to disable comments in WordPress in the theme editor

Now, search this code in the page.php file:

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

Replace it with the code below and update the changes:

<!-- Begin Comment 
<?php comments_template( '', true ); 
?> End Comment →

Similarly, search this code in the single.php file:

<?php comments_template(); ?>

Replace it with the code below and update the changes:

<!-- Begin Comment
<?php comments_template(); ?>
End Comment →

This lets you disable comments on all posts and pages.

Using a plugin

Yes, there are plugins available in WordPress to turn off comments. For this install one of these plugins.

After you install and activate, you can go through the plugin settings to disable the comment on your site. If you do not want to get involved with all the other methods, this is a quick solution for you.

Remove “Comments are Closed”

After following the previous methods, you may still get Comments are Closed message in the comment section of your posts. However, this can be fixed with ease.

For this, you need to have access to the File Manager either from cPanel or FTP. Look for the comments.php file in the theme folder and rename it to comments_old.php. Now create a new file with the name comments.php

This simply fixes the error as the new file has no comments template.

Wrapping Up

By this time, you should be clear on how to turn off comments in WordPress. If you are also one of them who does not require comments in your posts or page, you can follow the instructions given in this post.

Related Posts:

  1. How to customize homepage in WordPress
  2. How to embed an iFrame in WordPress
  3. How to change max upload size in WordPress