How to Disable Comments on WordPress in 9 Easy Ways [2023]

How to disable comments on WordPress: a step-by-step guide
  1. Why disable comments in WordPress?
  2. How to disable comments on WordPress
  3. Conclusion

Do you want to know how to disable comments on WordPress, completely or just on some parts of it?

Comments are a way for people to interact with your website, but you may have reasons to disable them.

You can choose to disable comments in WordPress on specific posts, pages, or custom post types, or you can delete comments from your entire website altogether.

In this article, we will guide you through how to disable comments in WordPress, step by step.

Why disable comments in WordPress?

There are various reasons why you might want to turn off comments on certain posts or pages, or even disable them on your entire website.

For instance, bloggers sometimes publish posts, like announcements, where they don’t want people to post comments.

In such cases, it’s simple to disable comments in WordPress for those specific posts or pages.

Many small business owners use WordPress to create their websites.

These business websites often consist of static pages such as services, about us, contact, etc., without a dedicated blog section. In these situations, what makes sense is to disallow comments.

Another common scenario is when some business blogs choose to disable WordPress comments altogether to avoid spam comments.

While there are ways to protect against spam (which we’ll discuss later in this article), You can entirely solve the problem by disabling comments in the comments section.

Regardless of your reason, you can definitely disable comments and even remove the comments section from your WordPress site completely.

1.) Disable comments completely

Disabling comments in WordPress and removing all comment-related features from both the admin panel and the front end of your website is extremely straightforward.

To achieve this, you can use the free WPCode plugin, which offers a collection of pre-configured code snippets.

Disable comments in WordPress with the help of WPCode plugin

One of these snippets is called ‘Completely Disable Comments,’ and it allows you to eliminate any trace of WordPress comments from your site.

To get started, all you need to do is install and activate the WPCode plugin on your WordPress website.

1.) Go to Code Snippets, and then Library in your WordPress dashboard

2.) Search for ‘completely disable comment’, then click on ‘Use snippet’

enable or disable comments

The plugin will take you to the ‘Edit snippet’ page after configuration.

3.) Switch the toggle to ‘Activate‘ and then click ‘Update’

edit code snippet for disabling comments

Once you have used the WPCode plugin and applied the ‘Completely Disable Comments’ snippet, all comments-related features will be disabled on your website.

Alternatively, if you are comfortable with advanced coding and prefer to do it manually, you can follow these steps:

  1. Locate your theme’s functions. php file. It is usually found in your theme’s directory.
  2. Open the functions.php file using a code editor or the built-in file editor in your WordPress admin panel.
  3. Copy and paste the following code into the functions.php file:
add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;
     
    if ($pagenow === 'edit-comments.php') {
        wp_safe_redirect(admin_url());
        exit;     }  
    // Remove comments metabox from dashboard
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
 
    // Disable support for comments and trackbacks in post types
    foreach (get_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');
        }
    }
});
 
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
 
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
 
// Remove comments page in menu
add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
});
 
// Remove comments links from admin bar
add_action('init', function () {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
});

2.) Disable comments in future WordPress posts

If you’ve recently launched your WordPress site, it’s simple to prevent site visitors to upload comments on your future posts.

To disable WordPress comments, do the following:

  1. In your WordPress dashboard, navigate to the left sidebar and click on “Settings” and then “Discussion”.
  2. In the discussion box uncheck “Allow people to post comments on new articles” to disable comments on future posts.
  3. Finally, click the “Save Changes” button to save your updated comments settings.
receive comments and comment notifications when checking the box

By disabling the setting, you will effectively turn off comments for all your future posts.

However, if you have the need to control comments on a specific WordPress post individually, you can do so without altering this global setting.

We will explain how to disable comments in WordPress selectively in the next section.

3.) Disable comments on a particular post or page

By default post settings, all your WordPress pages have their comments disabled.

Nevertheless, WordPress grants you the flexibility to disable or enable comments for individual pages and posts.

To disable WordPress comments, do the following:

  1. Go to the left sidebar in your WordPress dashboard and click on “Pages,” then select “All Pages.”
  2. Find the title of the post or page you want to disable the comments at and click on the “Edit” link that appears.
edit individual post

3. At the top-right corner of your page, you will notice an icon consisting of three vertical dots. Click on this icon to reveal a dropdown menu, then select “Options”.

4.This action will open a popup box where you should ensure that the “Discussion” box is enabled or selected.

settings page

After closing the modal box, you will find the Discussion settings meta box on the right side of your editor. If it’s not visible, ensure that you click on the “Document” tab to display it.

disallow unwanted comments

5. Now, you can selectively disable comments by unchecking the “Allow Comments” box. After making this change, click on “Update” to save settings.

You can follow the same process mentioned above to disable comments on individual posts or other custom post types.

4.) Disable comments in bulk

If you want to disable comments globally on all your published posts and pages, you can bulk disable comments without relying on a WordPress plugin.

Start disabling comments with these steps:

  1. Go to “Posts” and select “All Posts” to view all your articles.
  2. Check the box at the top to select all the posts on the page. If you have multiple pages of posts, you may need to repeat this step for each page.
  3. In the “Bulk Actions” dropdown box, choose “Edit” and click on “Apply.”
bulk edit posts

You will now have the ability to perform various bulk actions, including other comment settings for all the selected posts.

To globally disable comments on all the existing posts, follow these steps:

  1. Locate the “Comments” dropdown box.
  2. Select the option “Do not allow” from the dropdown menu.
  3. Click on the “Update” button.
bulk edit comment section

Similarly, you can use the same process to disable comments on your pages.

5.) Delete all comments

Although the methods mentioned earlier will stop new comments from being posted on your posts and pages, they won’t automatically remove the comments that are already present on your WordPress site’s comments section.

If you want to delete all the existing comments from your site, follow these steps:

  1. In your WordPress dashboard, look for and click on “Comments” in the admin menu sidebar.
move comment section to trash

2. Next, you need to select all the comments by checking the boxes next to them.

To do this, you can either manually select the WordPress comments or use the “Select All” option, usually located at the top of the comments list.

3. Once you have selected all the comments, go to the “Bulk Actions” dropdown box and choose the option that says “Move to Trash.”

After selecting this option, click on the “Apply” button.

If you have more comments left in the comments section, repeat the steps until you have deleted all of the WordPress comments.

6.) Disable comments on media pages

If you want to disable comments on media pages, there are two approaches you can take.

The first option is to manually disable comments on individual media files, as discussed earlier.

However, disabling comments with this method can be time-consuming if you have a large number of media files.

The second and easier approach is to use a code snippet.

If you are an advanced user, you can paste the provided code into your theme’s functions.php file.

However, we do not recommend this method, as editing core files can easily break your WordPress site if not done correctly.

Exercise caution when making changes to core 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 );

We highly recommend using WPCode as it is a user-friendly solution for adding custom code to your WordPress site.

  1. Install and activate the free WPCode plugin. After, access the Code Snippets section in your WordPress dashboard. You can find it in the menu.
  2. In the Code Snippets area, locate the option that says ‘Add Your Custom Code (New Snippet)’ and hover your mouse over it.
  3. Click on the ‘Use Snippet’ button that appears.
use snippet for disabling your website's comments

After following the previous steps, you will be directed to the ‘Create Custom Snippet’ screen.

4. On this screen, you can customize your snippet by giving it a descriptive title. For example, you could use ‘Disable Comments’ to clearly convey its purpose.

comment moderation with code

5. Please ensure that you have selected ‘PHP Snippet’ from the drop-down menu labeled ‘Code Type.’ This ensures that the code you’ve entered will be interpreted as PHP code.

Make sure that the switch next to the code snippet is toggled to the ‘Active’ position. This enables the snippet to be active and functional on your website.

7.) Use a disable comments plugin

If you prefer not to disable comments manually, there is a convenient solution available: the Disable Comments plugin.

With just a few clicks, you can disable comments across your entire WordPress site or on specific post types.

  1. Install and activate the Disable Comments plugin.

2. After activating the plugin, access the Disable Comments settings by going to Settings » Disable Comments in WordPress.

In the plugin settings, you have two options:

  • If you choose the ‘Everywhere’ option, comments will be disabled site-wide.
  • Or you can select the ‘On Specific Post Types’ option.
closing comments in the plugin settings

For specific scenarios, such as removing comments from media attachments or turning off comments solely on WordPress pages, or media attachments select the “Specific post type” button and check the ‘Media‘ box.

  1. Click “Save changes” when you are done.

8.) Hide the “comments are closed” message

If your WordPress theme is not properly handling the comment status, you might still encounter issues like the display of the comment form, existing comments, or the “Comments are closed” message.

This is not a compliant approach, and it’s advisable to address it.

1.) Contact your theme developer: Reach out to the developer of your theme and explain the issue.

Request their assistance in fixing the problem as it is not aligned with standard practices.

2.) Fix the WordPress comments yourself:

  1. Connect to your WordPress website using an FTP client or the File Manager in your hosting control panel. After that, navigate to the folder of your current theme, typically located in the /wp-content/themes/ directory.
  2. Find the file named comments.php in your theme folder. Right-click on it and rename it to comments_old.php.
change the php for old comments

3. Right-click in the right panel of your FTP client and select the option to create a new file.

4. Name the new file comments.php and click the OK button.

This approach essentially provides an empty comments template to your WordPress theme, preventing the display of comments or comment-related messages.

If your WordPress theme does not include a comments.php, it’s recommended to consult your theme developer to determine which file should be edited in order to address the issue effectively.

9.) Disable comments for spam protection

If you’re considering disabling WordPress comments solely to protect your site from spammers and link builders, we recommend trying these techniques to combat spam effectively.

Akismet

Use the Akismet plugin, created by the WordPress team, which is highly effective in handling spam comments.

unable to submit comments if spam

It checks each comment on your site to determine if it’s spam or legitimate.

Closing post comments

Did you know you can automatically close comments after a specific period of time?

In the “Settings » Discussion” settings section, enable the option that says “Automatically close comments on articles older than X days.”

WordPress discussion settings

By default, it’s set to 14 days, but you can adjust it based on your preferences.

Since spammers tend to target older posts, increasing this period, such as to 180 days, can significantly reduce spam.

Honeypot with Antispam Bee

Adding the Antispam Bee plugin alongside Akismet can further reduce comment spam on your site.

Antispam bee plugin

It incorporates an invisible honeypot that effectively blocks around 99% of spam bot comments.

Comment captcha

Although adding a captcha to your comment form can be less user-friendly, it helps protect your site from spammers.

prevent people spamming comment forms

You can use the Advanced noCaptcha and Invisible Captcha plugin to integrate Google reCaptcha just before the submit button of your comment form.

Remove website URL form field

To discourage link builders and spammers, consider removing the website URL field from the comment form.

delete comments link from comment box

This can be easily achieved using plugins like Comment Link Remove and Comments Tool, which allows you to remove the website URL field without any coding.

Blocking bad IPs

Another effective approach is blocking malicious IP addresses from accessing your WordPress website.

This helps prevent spam and potential hacking attempts. Check out our article about WordPress website security.

Bonus tip to replace WordPress comments

By disabling comments on your WordPress website, you’re not severing all interaction with your visitors.

If you have a dedicated forum or use other platforms like social media or a membership site for communication, you don’t need comments on your WordPress website.

Disabling comments allows your site to concentrate on its main objectives, such as providing information and driving sales.

Some of the popular forums to use for communication:

  • 1phpBB: As an open-source forum software it lets you create and manage online communities.
  • vBulletin: The commercial forum software known for its extensive features and customization options.
  • bbPress: A WordPress plugin that enables you to integrate a forum directly into your WordPress site.
  • Discourse: An open-source platform designed for modern, dynamic discussion forums with features like real-time updates and notifications.
  • XenForo: A commercial forum software that offers a sleek and user-friendly interface along with advanced moderation tools.

Conclusion

At times, you may want to encourage interactions and discussions among visitors on your website.

However, if you’re concerned about spam or wish to enhance performance, disabling WordPress comments might be a better option.

There are three primary methods to disable comments in WordPress:

  1. Built-in Options
  2. WordPress Plugin
  3. Custom Code

Now, let’s hear from you: Do you currently have comments enabled on your site?

Feel free to share your experience in the comments section below!

Frequently Asked Questions

How do I turn off comment moderation in WordPress?

To turn off moderation in WordPress, go to your WordPress admin panel and navigate to Settings » Discussion.
Uncheck the option that says “Comment must be manually approved” or similar. Save your changes, and comment moderation will be disabled.

How do I remove comments from the WordPress menu?

To delete comments from the WordPress menu, go to your WordPress admin panel and navigate to Appearance » Menus.
Find the “Comments” option in the menu structure and remove it from the menu. Save your changes, and comments will no longer be displayed in the WordPress menu.

How do I turn off the comment section?

To turn off the comment section in WordPress, go to Settings » Discussion in your WordPress admin panel.
Uncheck the option that says “Allow people to post comments on new articles.” Save your changes, and the comment section will be disabled for all future posts.

Leave a Reply