Skip to content

How to disable comments in WordPress posts?

WordPress is one of the most popular platforms for creating blogs and websites. While comments are an essential part of most blogs, they can also be a source of spam or unwanted interaction. As a result, some site owners may want to disable the comments section on their WordPress site. Here are some ways you can do this:

Solution 1: Disabling comments using the WordPress admin panel

The easiest way to disable comments is to use the options available in the WordPress admin panel. Here's how to do it:

  1. Log in to your WordPress account.
  2. Click on “Settings” in the toolbar on the left, then select “Discussions.”
  3. In the “Article Default Settings” section, uncheck the “Allow comments on new articles” box.
  4. Click “Save Changes” to make your changes.

Solution 2: Disable comments on a single post or page

Sometimes you may want to disable comments only on a specific post or page. Here's how to do it:

  1. Find and open the post or page for which you want to disable comments.
  2. Scroll down to the "Discussions" section.
  3. Uncheck “Allow comments.”
  4. Click “Update” or “Publish” to apply the changes.

Solution 3: Disabling comments via PHP code

If you are an experienced user, you can also disable comments by adding a code snippet to the functions.php file in your WordPress theme. Below is the code that will disable comments on new posts:

// Disable comments on new posts
function disable_comments_on_new_posts( $data ) {
    if( $data['post_type'] == 'post' && $data['post_status'] == 'publish' ) {
        $data['comment_status'] = 'closed';
    }
    return $data;
}
add_filter( 'wp_insert_post_data', 'disable_comments_on_new_posts' );

After adding this code, comments will be disabled on all newly created posts.

Solution 4: Use a plugin

If you don't want to experiment with code, there are many plugins that allow you to easily manage comments. One of them is “Disable Comments”, which allows you to disable comments on the entire page or only on specific types of posts.

  1. Install and activate the “Disable Comments” plugin.
  2. After activating the plugin, go to “Settings” > “Disable Comments” in the WordPress admin panel.
  3. Choose whether you want to disable comments on the entire page or only on specific post types.
  4. Click “Save changes”.

Finally, it's worth remembering that disabling comments is a decision that may affect interaction with users. Before making this decision, you may want to consider other comment moderation methods, such as spam filtering or approving comments before publication.

Check out the offer of 1500+ Premium WordPress plugins and themes!