Type something to search...
How to Disable Comments in WordPress?

How to Disable Comments in WordPress?

WordPress ships with comments turned on by default, which made sense when it was primarily a blogging platform. But if you're running a business site, a portfolio, a landing page, or anything without an active community discussing posts, comments tend to become pure liability: an endless stream of spam, a maintenance burden, and one more attack surface to keep secure, with none of the engagement upside.

Turning comments off sounds like it should be one checkbox, and for new content, it is. The complication is that a single setting doesn't touch posts that already exist, doesn't remove the now-empty comment form still rendering on your pages, and doesn't clean up the comments-related clutter left behind in your dashboard. This guide covers all of it: the dashboard setting, bulk-disabling existing posts, and a complete code-based approach if you want comments gone everywhere, permanently.

Method 1: Turn Off Comments for All New Posts

Start here, since it's built into WordPress and takes effect immediately for anything you publish going forward:

  1. Go to Settings → Discussion in your dashboard.
  2. Uncheck Allow people to submit comments on new posts.
  3. Click Save Changes.

This is the important limitation to understand: this setting only changes the default for posts created after you save it. Every post and page that already exists keeps whatever comment setting it had when it was published, so your existing content will still show comment forms until you address them separately.

Method 2: Bulk-Disable Comments on Existing Content

To close comments on everything you've already published, without editing each post individually:

  1. Go to Posts → All Posts.
  2. Click Screen Options in the top-right corner, and increase Number of items per page to a number larger than your total post count, so everything is selected in one pass.
  3. Check the box at the top of the list to select all posts.
  4. From the Bulk actions dropdown, choose Edit, then click Apply.
  5. In the bulk edit panel, find the Comments dropdown and set it to Do not allow.
  6. Click Update.

Repeat the same process under Pages → All Pages if your pages have comments enabled too. This closes the comment form on every existing piece of content and hides any comments that were already submitted, all without touching a single line of code.

Method 3: Disable Comments Completely With Code

If you want comments gone site-wide, permanently, with no dashboard checkbox left to accidentally re-enable, add the following to your theme's functions.php, or better, a must-use plugin so it survives a theme switch:

// 1. Remove comment and trackback support from every post type.
add_action( 'admin_init', function () {
    $post_types = get_post_types();

    foreach ( $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' );
        }
    }
} );

// 2. Force comments and pings closed everywhere, including old posts.
add_filter( 'comments_open', '__return_false', 20, 2 );
add_filter( 'pings_open', '__return_false', 20, 2 );

// 3. Hide any comments that already exist in the database.
add_filter( 'comments_array', '__return_empty_array', 10, 2 );

// 4. Remove the "Comments" admin menu item entirely.
add_action( 'admin_menu', function () {
    remove_menu_page( 'edit-comments.php' );
} );

// 5. Remove the comment bubble/count from the admin bar.
add_action( 'wp_before_admin_bar_render', function () {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu( 'comments' );
} );

// 6. Remove the Discussion and Comments meta boxes from the post editor.
add_action( 'admin_init', function () {
    foreach ( [ 'post', 'page' ] as $post_type ) {
        remove_meta_box( 'commentsdiv', $post_type, 'normal' );
        remove_meta_box( 'commentstatusdiv', $post_type, 'normal' );
    }
} );

// 7. Remove the "Discussion" tab from the Screen Options panel.
add_filter( 'default_hidden_meta_boxes', function ( $hidden, $screen ) {
    $hidden[] = 'commentsdiv';
    $hidden[] = 'commentstatusdiv';
    return $hidden;
}, 10, 2 );

Here's why each piece matters, rather than just relying on the Discussion setting alone:

  • Step 1 stops WordPress from treating any post type as comment-enabled at all, which is a more fundamental change than simply closing the form.
  • Step 2 is the safety net that actually closes comments on content published before this code existed, exactly the gap Method 1 leaves open.
  • Step 3 hides any comments already sitting in the database, so old spam or legitimate comments don't keep rendering even with the form gone.
  • Steps 4-7 aren't strictly necessary for comments to be disabled, but they remove the now-pointless UI (an empty "Comments" admin page, a comment count that will always read zero, a Discussion meta box on every post) that would otherwise sit in your dashboard forever as visual clutter.

Disabling Comments on Only One Post Type

If you want comments gone from, say, your product custom post type, but still available on regular blog posts, scope the same logic to a single post type instead of looping through all of them:

add_action( 'init', function () {
    remove_post_type_support( 'product', 'comments' );
    remove_post_type_support( 'product', 'trackbacks' );
} );

add_filter( 'comments_open', function ( $open, $post_id ) {
    if ( get_post_type( $post_id ) === 'product' ) {
        return false;
    }

    return $open;
}, 20, 2 );

This pattern (checking get_post_type() inside the comments_open filter) is the key building block for any more targeted rule, like closing comments only on posts older than a certain date, or only within a specific category.

Removing the Comments Widget and REST API Endpoint

Two smaller cleanup items are easy to miss:

If your theme includes a "Recent Comments" widget in a sidebar or footer, it will keep rendering (usually just showing nothing useful) even after comments are disabled everywhere else. Remove it from Appearance → Widgets, since the code above doesn't touch widget areas.

If you don't need the comments REST API endpoint (used by things like Jetpack or headless front ends to fetch comments), you can disable it entirely:

add_filter( 'rest_endpoints', function ( $endpoints ) {
    if ( isset( $endpoints['/wp/v2/comments'] ) ) {
        unset( $endpoints['/wp/v2/comments'] );
    }

    if ( isset( $endpoints['/wp/v2/comments/(?P<id>[\d]+)'] ) ) {
        unset( $endpoints['/wp/v2/comments/(?P<id>[\d]+)'] );
    }

    return $endpoints;
} );

Only add this if you're confident nothing on your site (including a plugin) depends on that endpoint, since removing it will break anything that does.

Method 4: Use a Plugin Instead

If you'd rather not maintain this code yourself, Disable Comments is a well-maintained, widely used plugin that does everything in Method 3 through a settings screen: it lets you turn off comments site-wide or per post type, and it includes the same admin cleanup (menus, admin bar, dashboard widgets) automatically. It's a reasonable choice if you want this fully reversible through a UI rather than code you'd need to remove later.

Frequently Asked Questions (FAQ) About Disabling WordPress Comments

No, none of the methods above delete existing comments from your database. They hide the comment form and any existing comments from the front end. If you specifically want to permanently delete all existing comments, that's a separate step, done from Comments → Bulk Actions → Move to Trash (and then Empty Trash), independent of disabling new comments.

Yes, significantly. Most comment spam targets the comment form directly with automated bots, so removing the form (via Method 2 or 3) eliminates that vector entirely. If you still want a limited comment section somewhere, a spam-filtering plugin like Akismet is the better tool for that specific case.

Pingbacks and trackbacks are tracked separately from regular comments in WordPress, though they display in the same comment list. The pings_open filter in Method 3, and the trackback removal in remove_post_type_support(), specifically target this; make sure both are present, not just the comments_open filter alone.

Yes, use the same comments_open filter pattern shown in the "Disabling Comments on Only One Post Type" section, but invert the condition, returning false for every post except the specific page ID or post type you want to keep comments open on.

Yes, that's one of the main advantages of the plugin route over hardcoding the changes yourself: deactivating the plugin restores WordPress's default comment behavior immediately, with no code to track down and remove afterward.

WooCommerce product reviews are built on top of the standard WordPress comments system, so the product post type-specific example above will disable them. If you only want to remove star ratings but keep written reviews (or vice versa), that's controlled separately, from WooCommerce → Settings → Products → Enable reviews / Show "verified owner" label options.

Conclusion

For a quick, low-commitment change, the Discussion settings screen and a bulk edit on existing posts (Methods 1 and 2) get you most of the way there in a few minutes, with everything fully reversible through the dashboard. If you want comments gone permanently, with no setting left behind that could quietly get flipped back on, the code-based approach in Method 3 closes every gap: new posts, existing posts, the admin UI, and the now-pointless dashboard clutter that comments leave behind.

Whichever route you choose, disabling comments is one of the lowest-risk changes you can make to a WordPress site: there's no data loss, and every method above (including the code snippets) can be undone just as easily as it was applied.

Here are a few additional resources if you want to go deeper:

Tags :
Share :

Related Posts

Effortlessly Crafting Compelling WordPress Pages

Effortlessly Crafting Compelling WordPress Pages

As a website owner or content creator, having the ability to seamlessly add new pages to your WordPress site is crucial. Whether you're introducing a

Continue Reading
High Traffic Tips for WordPress Mastery 🚥

High Traffic Tips for WordPress Mastery 🚥

In our digital age, where online visibility is paramount, ensuring your WordPress site can handle surging traffic is crucial. Just like a finely-tune

Continue Reading
How Do I Change the WordPress Login URL?

How Do I Change the WordPress Login URL?

By default, every WordPress site's login page lives at the same predictable address: yoursite.com/wp-login.php (which also happens to redirect from

Continue Reading