Published on June 16, 2024

How to Disable Comments in WordPress

Comments can be a valuable part of your WordPress site, fostering engagement and community interaction. However, there are times when you may want to disable comments, whether it's to prevent spam, maintain a professional tone, or streamline your site's content management. Fortunately, WordPress offers several ways to disable comments, from adjusting settings to using plugins. In this comprehensive guide, we’ll walk you through how to disable comments in WordPress effectively.

Why Disable Comments in WordPress?

Before diving into the methods, let's explore why you might want to disable comments on your WordPress site:

  • Reduce Spam: Spam comments can clutter your site and negatively impact user experience.
  • Improve Performance: Disabling comments can reduce database load and improve site performance.
  • Maintain Professionalism: For corporate or portfolio sites, comments might not be necessary.
  • Focus on Content: Disabling comments can help keep the focus on your content rather than discussions.

Methods to Disable Comments in WordPress

There are several ways to disable comments in WordPress, depending on whether you want to disable them site-wide, on specific posts, or on custom post types. Let’s explore these methods in detail:

1. Disabling Comments Site-Wide

If you want to disable comments across your entire WordPress site, the built-in settings make it straightforward.

Using WordPress Settings:

  1. Navigate to Settings: Go to your WordPress dashboard and navigate to Settings > Discussion.
  2. Uncheck the Comment Settings:
    • Uncheck the option “Allow people to submit comments on new posts.” This prevents comments on future posts.
    • Optionally, you can also disable pingbacks and trackbacks by unchecking the appropriate box.
  3. Save Changes: Click on the “Save Changes” button to apply the new settings.

Closing Comments on Existing Posts:

To close comments on existing posts, follow these steps:

  1. Navigate to Posts: Go to Posts > All Posts.
  2. Select All Posts: Check the box at the top to select all posts.
  3. Bulk Actions:
    • Choose “Edit” from the bulk actions dropdown menu and click “Apply.”
    • In the bulk edit options, set the “Comments” dropdown to “Do not allow.”
    • Click “Update” to apply the changes.

2. Disabling Comments on Specific Posts or Pages

Sometimes you may want to disable comments on individual posts or pages.

  1. Edit the Post/Page: Go to Posts > All Posts or Pages > All Pages, then click “Edit” on the desired post or page.
  2. Discussion Settings: Scroll down to the “Discussion” section. If you don’t see it, click on “Screen Options” at the top and check “Discussion.”
  3. Uncheck Allow Comments: Uncheck the “Allow comments” box.
  4. Update: Click “Update” to save your changes.

3. Disabling Comments on Custom Post Types

To disable comments on custom post types, you might need to modify the post type registration code.

  1. Locate the Registration Code: In your theme’s functions.php file or a custom plugin, find the code where the custom post type is registered.
  2. Modify the Code: Add 'supports' => array( 'title', 'editor', 'thumbnail' ) to the post type registration arguments, excluding 'comments'.
  3. Save Changes: Save the changes to your functions.php file or custom plugin.

4. Using Plugins to Disable Comments

If you prefer not to touch any code or settings manually, several plugins can help you disable comments in WordPress easily.

Recommended Plugin: Disable Comments

The Disable Comments plugin is a popular choice for disabling comments across your entire site or on specific post types.

  1. Install and Activate the Plugin: Go to Plugins > Add New, search for “Disable Comments,” install, and activate the plugin.
  2. Configure Plugin Settings:
    • Go to Settings > Disable Comments.
    • Choose whether to disable comments everywhere or only on certain post types.
    • Save your settings.

5. Using Custom Code to Disable Comments

For those comfortable with adding custom code, you can disable comments by adding snippets to your theme’s functions.php file.

Example: Disable Comments Site-Wide

Add the following code to your functions.php file to disable comments site-wide:

Best Practices for Disabling Comments

  • Backup Your Site: Always backup your site before making changes.
  • Test Changes: Test the changes in a staging environment to ensure they work as expected.
  • Update Regularly: Keep your WordPress site, themes, and plugins updated to prevent security vulnerabilities.

Conclusion

Disabling comments in WordPress can help you maintain control over your site’s content and user interactions. Whether you choose to disable comments site-wide, on specific posts, or through custom post types, WordPress provides flexible options to meet your needs. Using plugins like Disable Comments can simplify the process, especially for those who prefer not to delve into code. By following this guide, you can effectively disable comments and focus on delivering high-quality content to your audience.

Let's
Chat