How to Disable Comments in WordPress

Get HubSpot's WordPress Plugin
Jamie Juviler
Jamie Juviler

Updated:

Published:

While WordPress comments can be an effective way to engage visitors and build a community on your website, the comments section can also become a breeding ground for spam, harmful links, self-promotion, or even offensive remarks. In other words, learning how to disable comments on WordPress is a must. Luckily, the WordPress disable comments feature is easy to navigate. 

wordpress disable comments image shows people discussing how to disable wordpress comments and hands typing on a computer keyboard

If you're in the Administrator role on a WordPress website, you can easily manage the comments section on your site. There's even an option to disable comments on some or all of your site pages if necessary. 

Grow Your Business With HubSpot's Tools for WordPress Websites

Let's walk through some reasons WordPress site Administrators may choose to use the WordPress turn off comments feature. Then, we'll dive into how to use the WordPress disable comments feature on individual pages or posts, multiple, the entirety of your site, or simply media attachments.

Why use the WordPress disable comments feature? 

Sure, comments can be a positive addition to your site content, but they’re not a necessity for an online presence. After all, you can also use social media channels to create connections and community within your audience. If you’re considering using the WordPress disable comments feature, here are a few reasons you might consider it. 

To prevent spam. 

Nearly a quarter of internet traffic comes from bad bots. There’s no shortage of bots looking to attack your site and negatively impact your comment section. Therefore, one way to combat this issue is to remove the ability to comment altogether. Alternatively, you can install a security plugin. Need suggestions? Here are 16 of our favorite security plugins for WordPress websites. And if you want to double down even more on security, here’s how you can do so

To save time and resources. 

Moderating and responding to comments is an investment in time and money. It’s important work to ensure your site’s comment section is engaging and safe, but if you’re not seeing a return on investment or feel your resources could be allocated elsewhere, it may be time to use the WordPress turn off comments feature.

To keep your comments in one place.

Maybe you’ve set up a WordPress forum for site visitors to discuss, or you want to keep all of your comments on social media. Whatever the case may be, it can get complicated if you’re moderating comments in a variety of places. 

To use a plugin instead. 

With so many WordPress plugins available in the directory, it’s probably no surprise that there are options available to handle comments for you. It’s worth considering a commenting plugin to replace WordPress’s default comment feature. 

To increase your page speed performance. 

Ever wondered how important your website page load time is? We’ll be the first to admit that your site loading quickly is crucial to its success. However, having a hefty page with tons of comments can weigh it down and make your site load slower. If you’re not ready to part with your comments, consider lazy loading to boost performance without cutting comments entirely. 

They're not needed on a post. 

Most static pages don’t need comments, especially main pages such as your home, about, and contact pages. In fact, having a comments section on these pages could actually come across as unprofessional. WordPress automatically disables comments on pages, so this isn’t an issue unless you’ve changed this default setting. However, you might also choose to enact the WordPress disable comments feature on a post. For example, you might not want a comment section on an announcement post.

They don't serve website goals or aren't on brand. 

You might just prefer not to have comments on your posts if you believe they won’t add value to your content. Comments could even make your site appear unprofessional if unmoderated and inappropriate. Ultimately, the choice to disable comments is up to you, based on the specific goals of your website. Use your best judgment here — you can always turn comments off or back on if needed.

By default, WordPress prevents comments on pages and allows comments on posts. This is because you likely won't want comments on your main pages, like your homepage, but might still want comments on content like blog posts. Of course, you can also decide that you'd like to turn off comments on posts. We'll walk you through how to do all of that and more. 

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

Sometimes, you might want to keep comments active across your site but turn them off for specific posts. Here's the process to do so:

To disable comments on an individual post or page:

  1. Select Posts > All Posts or Page > All Pages in the left side panel of the dashboard.

  2. Hover over the specific post and select Edit.

  3. Under the Discussion section in the right panel, uncheck the box next to Allow comments.

  4. Click Update.


wordpress disable comments

Disabling comments on a page or post won't get rid of existing comments.

To delete an existing comment:

  1. Select Comments from the dashboard.

  2. Hover over the comment you want to delete and click Trash.

How to Disable Comments on Multiple Pages or Posts in WordPress

To disable comments on multiple pages or posts at a time:

  1. Select Pages > All Pages or Posts > All Posts from the dashboard.

  2. Check the boxes of all posts you want to edit.

  3. In the Bulk Actions dropdown menu, select Edit, then Apply.

  4. In the Comments dropdown menu, select Do not allow.

  5. Click Update.

How to Disable Comments Globally in WordPress

Want to use the WordPress turn off comments feature globally? Turning off all commenting on a WordPress site is a three-step process: Disabling comments on new posts, disabling comments on old posts, and (if you want) deleting some or all existing comments.

To disable all comments on future posts:

  1. Select Settings > Discussion from the dashboard.

  2. Uncheck the box next to Allow people to post comments on new articles.

  3. Click Save Settings. 

wordpress disable comments: the discussion settings menu in wordpress where users can disable comments

To disable comments on existing posts:

  1. Select Settings > Discussion from the dashboard.

  2. Check the box next to Automatically close comments on articles older than _ days and set the number of days to zero.

  3. Click Save Changes at the bottom of the page.

To delete existing comments on your site: 

  1. Select Comments from the dashboard.

  2. Check the boxes of all comments you want to delete.

  3. Select Bulk Actions > Move to Trash.

  4. Click Apply.

How to Disable Comments on Media Files in WordPress

Did you know that even after disabling comments on your posts and pages, your media files will continue to be open for comments? You can do so by altering some source code. 

To disable comments for all media attachments on your site:

  1. Open the "functions.php" file of your WordPress theme.
  2. Paste the following code at the bottom of the file, then save the 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 );

How to Disable Comments With a WordPress Plugin

While WordPress core does allow you to disable comments and edit settings through its easy-to-use interface, you might prefer a plugin to disable website comments instead. Disable Comments is a popular reputable plugin you can use to turn off all comments on your WordPress site with a click. If you want to use this WordPress plugin to disable comments, here's how you would do so.  

To disable comments globally with the Disable Comments plugin:

  1. Install the plugin from the download page.

  2. After installation, select Settings > Disable Comments from your dashboard.

  3. From here, you can disable comments on all pages, posts, and media. You can also disable comments only on certain post types.

  4. Click Save Changes.

wordpress disable comments

Source

How to Remove the 'Comments Are Closed' Message in WordPress

After you disable comments, your pages might display a "comments are closed" message at the bottom. To get rid of this message:

  1. Connect to your WordPress site using an FTP client.

  2. Open the current theme folder, which is in the directory "/wp-content/themes/".

  3. Find the file "comments.php" and rename it to "comments_old.php".

  4. Create a new file and name it "comments.php". Doing this should remove the message.

If your theme doesn't have a "comments.php" file, contact the theme's developer and ask them how to resolve this error. 

Use the WordPress disable comments feature to better your site. 

Comments work for some websites and not others. It's up to your own preference and whether you see comments as beneficial. You can still provide quality content without comments to reaffirm — let visitors decide for themselves whether your site is worth returning to.

Editor's note: This post was originally published in August 2020 and has been updated for comprehensiveness.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

 

Related Articles

Capture, organize, and engage web visitors with free forms, live chat, CRM, analytics, and more.

DOWNLOAD THE FREE PLUGIN

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO