How to Enable and Disable Comments in WordPress

Updated on Dec 6, 2022

We are all aware of the WordPress platform's ability to enable users to post and read comments. Not all website owners who use WordPress to create their websites, however, favor allowing debate. The admin dashboard and website loading times are typically the biggest issues. Another issue that many website owners worry about is spam; thus, eliminating the main source of spam is a good adjustment.

Follow these steps to understand how to control the comment feature:

step

Pros and Cons of Disabling Comments in WordPress

Pros:

  • Increase your level of control by setting up a different plugin, such as Disqus, to handle interactions.
  • Prevent spam and automated comments from loading more slowly by not allowing them.
  • Avoiding phishing efforts will keep the user base secure, which is especially important for blogs on cryptocurrencies, finances, and real estate.
  • Use comments to stop arbitrary code execution attempts.
  • Change the channel of communication to social media, a special forum, or a group chat software like Discord.

Cons:

  • It may be harmful to completely delete comments from community-based websites.
  • If users can't leave feedback, some users might find that annoying.

Note:
Only certain posts or pages can have comments enabled or disabled via the "conversation" settings on each one.

In this tutorial, we'll cover how to enable or deactivate comments on your website for all upcoming posts, delete comments from attachments, and disable current comments individually and in bulk.

If you want to learn more about this part of the configuration on your website, check out our other tutorial called How to Manage Comments in WordPress.

step

How to Disable Comments in WordPress using Standard Dashboard Settings

For the majority of webmasters, the default options offered by the core platform are more than sufficient for controlling how users can comment on their material. We'll demonstrate how to disable comments both individually and in bulk in the following subsections, as well as how to stop users from interacting with articles' media files.

Enable and Disable Comments for Future Posts

To begin, you will have to log in to your site's admin area and navigate to Settings → Discussion:

Go to Settings Discussion

There are numerous alternatives available after you enter that section. Don't be intimidated; all you need is the "Allow people to submit comments on new articles" field for this one. The first set of options on that page is where you do that:

Allow People to Submit Comments

For more information on the rest of the settings, visit our How to Configure your Settings in WordPress tutorial.

If you would want to enable or disable comments on your website, please check or uncheck this box. When you're finished, scroll to the bottom of the page and click the Save Changes button.

Disable Comments on Selected Posts (or pages) in Bulk

The user can still leave comments on posts that have already gone live even if comments on future articles are disabled. Additionally, if you have numerous posts, inputting the editing choices for each one one at a time can be time-consuming. In this situation, you can make use of WordPress' bulk editing functionality. Select the posts you want to alter by going to the All Posts section. Next, select Edit from the Bulk Action drop-down option and then click Apply.

Bulk Actions Edit

By doing so, the primary post options will appear, which you can modify for all of the selected posts at once. Select Don't enable the comments field, then click Update.

Disable Comments on Existing Posts Individually

You can disable comments separately for each post if you only wish to do so for a few separate posts. Make sure Discussion is turned on in the Screen Options menu before you use the edit post interface.

Turn on Comments in Screen Options

The Allow Comments field will then be displayed, which you can tick to stop comments on this post.

Allow Comments in WordPress

Before you leave, be sure to click the Update button.

Disable Comments on Media Files

WordPress has a feature that allows users to leave comments on media assets like images and videos, but many users are unaware of it. Additionally, there are bots created explicitly to take advantage of that capability, making media comments a potential security risk. Enter the Media Library area of your Dashboard and select the Edit option for the media file you wish to secure in order to disable comments on that item. Again, find the Allow Comments checkbox and uncheck it.

Enable and Disable Media Files Comments

step

How to Disable Comments with a Plugin

Using the Disable Comments plugin can help you avoid a lot of hassle. This plugin's sole goal is to eliminate every chance a comment may possibly appear on your page. All you have to do is go to the plugin's Settings and then Disable all Conversations:

Disable Comments Everywhere with a Plugin

After installation, you will have the choice to permanently silence all conversations, even throughout the full multisite installation network. The alternative is to disable comments on one of your website's specified commentable posts, pages, or media.

Disable Comments on Specific Posts with a Plugin

step

How to Disable WordPress Comments with a Custom Code

You may also be able to disable comments by manually inserting a code snippet into a few of your WordPress files, depending on your theme.

Warning!
Making changes to WordPress files may result in errors or a total failure of your website to load. Not recommended for beginners!

Utilize your cPanel to access the File Manager. Next, go to the location of your WordPress installation, which is often /home/youruser/public_html/wp-includes, and select the functions.php file, then click the edit button.

Then add this after the 1st line, which is the opening <?php tag:

add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;

    if ($pagenow === 'edit-comments.php') {
        wp_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);
    }
});

On each of the imposed restrictions, you have comments that detail the precise impact. If you wish to keep some features while eliminating others, this will be helpful.

Congratulations! After finishing reading this article, you now understand how to change the settings for the comments on your website!

On this page...

    WordPress Hosting

    • Free WordPress Installation
    • 24/7 WordPress Support
    • Free Domain Transfer
    • Hack-free Protection
    • Fast SSD Storage
    • Free WordPress Transfer
    • Free CloudFlare CDN
    • Immediate Activation
    View More