How To Disable Comments In WordPress?


How to disable comments in WordPress

Dealing with spammy and unfavourable comments on your WordPress website in 2023 sounds old, right? Do you want to disable comments in WordPress to simplify your website and enhance the user experience?

You may choose to disable comments on your WordPress website for a variety of reasons:

  • Maybe you don’t really need comments and they benefit your business purpose.
  • You have been getting a lot of spammy and unwanted comments.
  • You may want to use some other plugin or require other comment settings.
  • You want to use Social comments rather than WordPress comments.
  • Comments are distracting your site visitors and affecting the page experience.

Table of Contents

In this guide, we will show you 7 easy ways to turn off WordPress Comments.

Why disable comments in WordPress?

We know that WordPress Comments can be useful at times but disabling comments in WordPress can be beneficial for a variety of reasons, including reducing spam and creating a more focused website experience. You can disable comments from future and published posts, pages, and other custom post types.

Spam Prevention 

If you are using WordPress, I am sure you must have had some spam comments on your website pages or posts. This is one of the most common reasons why website owners disable comments on their WordPress sites.

Comments attract spam and there’s this extra time and effort required to moderate and remove them. So, the best way to go about it is to turn off the comments.

Focused Website Experience

Not all comments are useful or valuable. These do not help any more than distracting site visitors and creating a negative impression of your WordPress website. Website owners spend so much time creating seamless user experiences and turning off the comments can help users focus more on the useful parts of the website. 

Legal Issues 

Enabling comments on your website can also increase the risks of legal issues such as defamation, hate speech, and copyright infringement. Disabling comments can help to avoid these problems. Letting visitors post unnecessary comments can raise legal issues if you are not clear about your policies.

Improving Website Performance

Comments are also some forms of data and they can create databases and queries. These can negatively affect website performance in terms of speed and user experience. If you want your website to be faster, you may want to disable comments.

Turning off WordPress comments can not be the go-to option for every website and it’s important to know that this doesn’t directly increase your website traffic. You need to decide if it’s the right move to disable comments on your website and if it’s right for your business or website goals.

If you are working on a website that focuses on engagement, you might not want to disable comments. Or you may only want some of your future posts to be comments-free. Instead, you can filter out the existing comments on a regular basis or use a plugin to filter out spammy comments. 

6 Methods to Disable Comments in WordPress

Now that we have discussed why it is important to disable WordPress comments, let us dive into the methods to implement those. Depending on your needs, you can use some or all of these six easy methods to turn off comments in WordPress as you like. 

Use Disable Comments Plugin

You can use disable Comments plugin or from the store to disable WordPress comments. This is the easiest of all ways to turn off comments in WordPress for current or future posts and disable the comments section.

Follow these steps to Disable WordPress comments using plugins.

Step 1: Search for the plugin in the WordPress store. 

Step 2: Install and activate the plugin.

Install disable comments plugins

Step 3: Go to the plugin settings page.

Disable comments plugin settings

Step 4: Configure settings as you would like and click on save.

You can use plugins to turn off specific WordPress pages or post comments completely or on specific pages or blog posts. Some of the plugins also allow custom settings for each page or post type on your website. 

Disable comments settings WordPress

5 Best Plugins To Disable Comments In WordPress

Edit Functions.php File

Another way to disable comments is to edit the functions.php file and add code to disable comments throughout the website or on specific pages or posts. 

For this, all you need to do is add a code snippet to your functions.php file found on WordPress Dashboard > Appearance > Theme Editor. 

Theme file editor functions php wordpress

 Copy and paste the following code on your functions.php file to turn off comments globally on your site.

// 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’)) {
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 visitor trying to access comments section or 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 section 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 Page Or Post Comments

If you do not want to turn off comments on all of your website posts, you may disable comments on individual posts and pages.

Step 1: Log in to your Dashboard.  

Step 2: Go to the post or page you want to disable comments on.

Edit page WordPress 1

Step 3: Go to the Discussion section.

Step 4: Uncheck the option ‘Allow Comments’.

This method is only recommended for small sites where it is feasible to go to WordPress Comments in the Discussion section to enable or disable comments for individual posts and make manual changes. 

Disable Comments For Media Files

Page discussion allow comments

You can disable comments for media files the same way you would for pages and post types.

  • Adding code snippets in the functions.php file on your theme editor: Add the following code to your functions.php file to disable comments in Media files and save it.

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

  • Using Disable comments plugins.
  • Opening individual media files and turning off comments.

Disable Comments On Specific Multiple Posts/Pages

If you want to bulk edit and disable comments on multiple web pages at once, go to Posts/Pages and select the pages/posts. Then, select Edit and click on Apply as shown below.

Bulk disable comments WordPress

Select ‘Do Not Allow’ from the dropdown on the Comments field and click on Apply. The process is exactly the same to bulk edit Posts as well.

Disable multiple page comments WordPress

Disable Comments In The Entire WordPress Site

You can choose to turn off comments across your WordPress website rather than selectively disable comments by unchecking the ‘Allow people to submit comments on new articles’ options on the Discussion settings of your WordPress dashboard.

Discussion WordPress comments disable

Disable Comments In WordPress via Database

This method is recommended for someone who is familiar with the backend of the site. We strongly recommend you make a backup of the site before proceeding with the steps as it involves modifying the database and it can break your site in case of errors.

To disable WordPress comments via database, you will need to access your website’s database with a tool like phpMyAdmin and follow the steps below:

Step 1: Find the table “wp_posts” and open it.

Step 2: Find the column “comment_status” and change the value from “open” to “closed” for all posts.

Step 3: Save your changes.

And, this is it! This should disable comments in WordPress including all pages and posts. 

I hope that the above methods helped you in finding answers to How to disable comments in WordPress? Firstly, be sure if you want to disable WordPress comments from your entire site or if you want to disable some specific posts/pages. Then, you can use any of the methods listed above that best fits your needs and expertise. Apart from these, you should check to see if the changes are intact from time to time. 

How can I remove the ‘Comments Are Closed’ Message in WordPress after disabling comments?

Do not worry if you are seeing the ‘Comments are closed’ message in your comments section after you disabled the comments. You can do this in any one of the following ways:

  • Add the following code snippet to the functions.php file. function remove_comments_closed( $open, $post_id ) { return false;}add_filter( ‘comments_open’, ‘remove_comments_closed’, 10, 2 );
  • Use a plugin like Disable Comments which automatically removes the message.
  • While we do not recommend editing the PHP files for beginners, you can also remove the message by editing your WordPress theme files, single.php, and page.php.

Still, it may not always be a good idea to turn off WordPress comments especially if you are looking for engagements. You can use plugins for moderation and prevent spammy comments. Another way is to allow commenting only for registered users. You should decide if comments are useful for your website, business, and users. You may also delete comments as well if it is spammy, irrelevant, or misinformation.

Filtering Spam Comments In WordPress

With the popularity of WordPress sites comes the challenge of managing comments, specially the spammy ones. There are multiple ways you can get rid of spam comments or filter them out.

  • You can use a plugin like Akismet to detect and flag spam comments. Then, you can remove comments. Akismet comes with WordPress but you can use other 3rd party plugins as well.
  • You can moderate comments. This means you will need to manually review the comments before they appear on your site and can be done through the Comment Moderation section in Discussion settings.
  • You can create a list of negative words and phrases in the Comment Moderation section. If these words appear in the comments, they will automatically be flagged as spam.
  • Blocking IPs is another way to filter spam comments. Add IP addresses that are spammy to block the addresses from commenting on your website.
  • You can also set up a captcha or use plugins like Advanced Custom Fields to filter out comments from Bots.
  • You can also only allow registered users to comment on your post or pages.

People Also Asked

What is the difference between disabling comments on the entire website and disabling comments on a specific post or page?

If you disable comments on the site, no comments can be posted on any WordPress post or page. While turning off comments on a specific post or page will only disallow comments on the selected pages.

How can I enable comments after disabling comments in WordPress?

Yes, you can re-enable WordPress site comments even after they were disabled. You will need to reverse the method used to disable or check settings for each post or page manually to re-enable existing comments. But you may not be able to retrieve the deleted comments.

What is the effect of turning off comments on my WordPress site SEO?

There is no direct effect of turning off comments on website SEO. However, the UX aspect of the site will definitely be affected if the comments are spammy or inappropriate.

How can I remove existing comments while allowing comments on future posts?

You will need to install a WordPress plugin for comment moderation like Akismet if you want an easy way. You can also delete comments manually by going into the WordPress Dashboard > Comments.

Are there any risks to disabling comments via the database?

Yes, there are risks to disabling comments through the database if not done carefully. Changes in the database can break your WordPress site in case of errors and this is why we recommend you to create a backup of your site before proceeding with this method. 

Will disabling comments also remove the comment count from my WordPress website?

Yes, disabling comments will also remove the comment count from your site.

How can I disable comments for certain post types, such as attachments?

To disable comments for certain post types of your WordPress site, you can either use a plugin like …. Or edit your functions.php file to add code snippets

Can I disable comments for specific categories or tags?

Yes, you can disable comments for categories or tags. The easy method is to use a plugin. You can go into the plugin settings and configure your settings accordingly. You may also do this by editing the settings for each individual category or tag.


Updated on: 18 January 2023 |


Sazjan Neupane

Sazjan Neupane

Sazjan helps us reach our dream clients with his expertise in Search Engine Optimisation, PPC, Project Management & Online Business Development. He has worked with a variety of clients in different industries over the last 5 years. In his free time, Sazjan enjoys traveling and exploring new cultures.