WordPress Logo – Athemeart WordPress Themes

How to Disable Comments in WordPress (8 Easy Ways, With or Without a Plugin)

Introduction: Why Disable Comments in WordPress?

WordPress was born as a blogging tool, so comments are switched on almost everywhere by default. That made sense in 2005. Today, a large share of WordPress sites are business websites, portfolios, documentation hubs, landing pages and WooCommerce stores, where an open comment box adds little value and attracts a steady stream of spam.

The catch is that WordPress has no single “off” switch. The obvious setting only affects new posts. Old posts keep their comment forms, pages and media files follow their own rules, bots can still post through endpoints you never see, and some themes keep printing “Comments are closed” after you’ve turned everything off. That’s why so many site owners search for how to disable comments in WordPress, follow a tutorial, and still find a comment box on their site the next day.

This guide closes every gap. You’ll learn eight reliable ways to turn off comments in WordPress: the built-in WordPress comment settings, bulk editing, the block editor, a free plugin, a custom PHP snippet, phpMyAdmin, WP-CLI and your theme’s templates. You’ll also learn how to hide or delete the comments that already exist. It’s updated for two things most tutorials still miss: WooCommerce product reviews (which are comments under the hood) and the Notes feature that arrived in WordPress 6.9.

Quick answer: how do you turn off comments in WordPress?

  1. Go to Settings β†’ Discussion, uncheck Allow people to submit comments on new posts and the two pingback/trackback options, then click Save Changes.
  2. Go to Posts β†’ All Posts, select every post, choose Edit from Bulk actions, set Comments to Do not allow, and click Update. Repeat for Pages.
  3. Go to Comments and trash (or unapprove) the comments that already exist so they stop showing on your site.

Prefer one sitewide switch? Use the free Disable Comments plugin (Section 7) or the copy-and-paste snippet in Section 8.

How to disable comments in WordPressIllustration of a WordPress post whose comment section has been switched off, next to the article title and the eight methods covered: Settings, Bulk Edit, Editor, Plugin, PHP, phpMyAdmin, WP-CLI and Theme.WORDPRESS GUIDEHow to DisableComments inWordPress8 easy ways, with or without a pluginSettingsBulk EditPluginPHPSQLWP-CLIEditorTemplatesathemeart.comyoursite.com/blog/hello-world/Leave a ReplyCommentsOFF
Disabling comments in WordPress takes three layers: future posts, existing posts and the comments that already exist.

Why You Might Want to Disable WordPress Comments

Comments can be great. On a busy blog they build community, answer follow-up questions and add fresh text to old articles. But on many sites they cost more than they give back. Here are the four most common reasons people decide to disable WordPress comments, plus a quick note on when you should keep them.

Reduce Spam Comments

Comment spam is automated. Bots don’t read your article or even load the page; they send form data straight to wp-comments-post.php, the REST API or XML-RPC, hoping a link to a casino, pharmacy or phishing site slips through. Even a brand-new site with almost no traffic can start receiving spam comments within days, simply because it runs WordPress.

Anti-spam plugins catch most of it, but “most” still means a moderation queue to check, false positives to rescue and a database that keeps growing. If you don’t want discussion on your site in the first place, the cleanest fix is to disable comments entirely so there’s nothing for bots to submit.

Improve Website Security

Every input field on a public website is a potential attack surface, and the comment form is one of the most-hit forms on the internet. Disabling comments helps your security in a few concrete ways:

  • Fewer malicious links. Spam comments often point to malware or phishing pages. If one gets approved by mistake, your site is now linking visitors (and search engines) to a bad neighborhood.
  • Less pingback abuse. Pingbacks run through xmlrpc.php, an endpoint that attackers have long abused for DDoS reflection and brute-force attempts. Turning off pingbacks and trackbacks shrinks that surface.
  • Less personal data to protect. Each comment stores a name, email address and IP address. Fewer comments means less personal data to secure, export or delete under privacy laws such as GDPR.

Disabling comments isn’t a security plan on its own, so pair it with one of the best WordPress security plugins for firewall rules, login protection and malware scanning.

Keep Your Website Clean and Professional

An empty “Leave a Reply” box under your About page, a “0 Comments” label on every service page, or a product page where the only comment is spam all make a site look unmaintained. Business sites, agency portfolios, SaaS landing pages and most WooCommerce stores look sharper without them.

There’s a small performance win too. When comments are closed, most themes stop loading the comment-reply.js script, and if you also switch off avatars you remove external Gravatar requests from every post. Long comment threads also add database queries and HTML weight to each page view.

Reduce Comment Moderation Work

Moderation is a quiet time sink: approving real comments, deleting spam, answering questions, handling the occasional rude reply, and clearing notification emails. You’re also responsible for what appears on your pages. If nobody on your team has time to moderate, an unmoderated comment section is a liability, and turning off comments in WordPress is the responsible choice.

When You Should Keep Comments On

Disabling comments is a choice, not a best practice for every site. Keep them if your blog gets genuine discussion, if readers regularly add useful tips, or if you run a community or membership site. A middle ground also works well: keep comments on blog posts, disable them on pages and media, or close comments automatically on posts older than a few months. If you move discussion elsewhere, give readers a path: a contact form, a support forum, a Q&A page or your social channels.

How to Disable Comments in WordPress

Before you click anything, it helps to understand one detail that explains most “I disabled comments but they’re still there” complaints.

WordPress stores comment status in two places. There’s a default setting (default_comment_status) that applies only when a new post is created, and there’s a per-post setting (comment_status) saved on every single post, page and media file. Changing the default never touches posts you’ve already published. That’s why a complete fix has three layers:

Which method should you use to disable comments in WordPress?Decision chart. New posts only: Settings, Discussion. All existing posts: Bulk Edit. One page or post: block editor or Quick Edit. Everything without code: Disable Comments plugin. Everything without a plugin: PHP snippet. Thousands of posts or server access: phpMyAdmin or WP-CLI.Which method should you use?Start with what you want to switch off, then follow the arrow.What do you want to turn off?Comments on newposts only↓Settings β†’ DiscussionComments on allexisting posts↓Bulk Edit β†’ Do not allowOne specific pageor post↓Editor or Quick EditEverything, sitewide,no code↓Disable Comments pluginEverything, sitewide,no extra plugin↓PHP snippet (mu-plugin)Thousands of posts orserver access↓phpMyAdmin or WP-CLITip: to switch comments off completely, combine Settings + Bulk Edit, or use one sitewide method (plugin, snippet, SQL, WP-CLI).
Pick the method that matches what you want to switch off. Most sites need Settings plus Bulk Edit, or one sitewide method.

Disable Comments on All Future Posts

This is the default setting in Settings β†’ Discussion. Uncheck it once and every post you create from now on starts with comments closed. It takes 30 seconds and it’s the first step for every site. Full walkthrough: Section 4.

Disable Comments on Existing WordPress Posts

Posts you’ve already published keep whatever comment status they had. To change them all at once, use WordPress’s built-in Bulk Edit, which can switch hundreds of posts to “Do not allow” in a few clicks. Full walkthrough: Section 5. For thousands of posts, the SQL and WP-CLI commands in Section 9 are faster.

Disable Comments on Individual Posts and Pages

Sometimes you only want to turn off comments on one post, or on a few pages such as Contact, Checkout or Privacy Policy. Every post and page has its own comment switch in the block editor and in Quick Edit. Full walkthrough: Section 6 and Section 12.

Here’s how all eight methods compare:

Method What it affects Skill level Hides old comments? Best for
Settings β†’ Discussion New posts only Beginner No Every site (step one)
Bulk Edit Existing posts and pages Beginner No Small to mid-size sites
Block editor / Quick Edit One post or page Beginner No Selected pages only
Disable Comments plugin Everything, by post type Beginner Yes (delete tool) No-code sitewide switch
PHP snippet (mu-plugin) Everything, sitewide Intermediate Yes Developers, no extra plugin
phpMyAdmin (SQL) Database-wide Advanced Yes (delete) Huge sites, broken admin
WP-CLI Database-wide Advanced Yes (delete) Agencies, many sites
Theme / page builder templates Front-end display Intermediate Yes (removes the section) Removing the comments area visually

Before you start, run through this short checklist:

  • Take a full backup (files and database), especially before deleting anything.
  • Decide whether to close, hide or delete old comments (see Section 11).
  • If you run WooCommerce, decide whether product reviews should stay on.
  • Export comments you might want later with Tools β†’ Export β†’ All content; the export file includes comments.
  • Test on a staging site first if your theme or plugins customize comments heavily.

How to Disable Comments Using WordPress Settings

The Discussion screen holds all of the built-in WordPress comment settings. It’s the fastest way to disable comments on WordPress posts you publish from now on, and it needs no plugin or code.

Log in to your dashboard as an administrator and go to Settings β†’ Discussion. You’ll see sections for default post settings, other comment settings, email notifications, moderation rules and avatars. The official WordPress Discussion Settings documentation explains every option in detail if you want to go deeper.

Uncheck the Comment Options

Under Default post settings, uncheck all three boxes:

  1. Attempt to notify any blogs linked to from the post: stops your site from sending pingbacks to other sites.
  2. Allow link notifications from other blogs (pingbacks and trackbacks) on new posts: stops other sites from adding pingbacks and trackbacks to your posts. These are almost entirely spam today.
  3. Allow people to submit comments on new posts: the main switch that disables comments on every new post.
WordPress Settings, Discussion screen with comment options uncheckedMockup of the Discussion Settings screen. Under Default post settings, three boxes are unchecked: Attempt to notify any blogs linked to from the post, Allow link notifications from other blogs (pingbacks and trackbacks) on new posts, and Allow people to submit comments on new posts. The Save Changes button is highlighted.β“Œ My Site + NewDashboardPostsMediaPagesCommentsAppearancePluginsUsersToolsSettingsGeneralWritingReadingDiscussionMediaDiscussion SettingsDefault post settingsAttempt to notify any blogs linked to from the postAllow link notifications from other blogs (pingbacks and trackbacks) on new postsAllow people to submit comments on new postsIndividual posts may override these settings. Changes here will only be applied to new posts.1Other comment settingsComment author must fill out name and emailUsers must be registered and logged in to commentAutomatically close comments on old postsOptional safety netBlocks anonymous bots if a post slipsthrough with comments still open.Email me wheneverAnyone posts a commentA comment is held for moderationSave Changes2Uncheck the three boxes, then save
Settings β†’ Discussion: uncheck the three default post settings, then click Save Changes.

Notice the line under those boxes: “Individual posts may override these settings. Changes here will only be applied to new posts.” That sentence is the reason this method alone isn’t enough for an established site.

While you’re on this screen, two optional settings act as a safety net in case a post ever slips through with comments open:

  • Users must be registered and logged in to comment: blocks anonymous visitors and most bots.
  • Automatically close comments on old posts: closes the comment form after a set number of days.

You can also uncheck Show Avatars in the Avatars section if you don’t need them, which removes Gravatar image requests from the front end.

Save Your Changes

Scroll to the bottom and click Save Changes. From now on, every new post starts with comments and pings closed. Pages already default to closed comments in modern WordPress (that changed back in version 4.3), but pages created before then, or by importers and page builders, may still be open. The next section fixes everything you’ve already published.

How to Disable Comments on All Existing WordPress Posts in Bulk

Bulk Edit is the quickest way to disable post comments in WordPress across your whole archive. It changes hundreds of posts in a few clicks, without code, and works for posts, pages and most custom post types.

  1. Go to Posts β†’ All Posts.
  2. Click Screen Options at the top right and raise Number of items per page from the default 20 to a higher number (up to 999), then click Apply. This lets you edit more posts in one go.
  3. Tick the checkbox in the table header to select every post on the page.
  4. Open the Bulk actions dropdown, choose Edit, and click Apply.
  5. In the Bulk Edit panel, set Comments to Do not allow and Pings to Do not allow.
  6. Click Update.
Bulk Edit panel in WordPress with Comments set to Do not allowMockup of Posts, All Posts with every post selected, Bulk actions set to Edit, and the Bulk Edit panel open. The Comments dropdown is set to Do not allow, Pings is set to Do not allow, and the Update button is highlighted.PostsAdd PostEditβ–ΎApply1Select all posts β†’ Bulk actions: Edit β†’ ApplyBULK EDITβ“§ Hello world!β“§ 10 Tips for Faster WooCommerceβ“§ Our Spring Collection Is Liveβ“§ How We Ship Worldwideβ“§ Meet the Teamβ“§ Holiday Opening Hours…and 14 moreCategories☐ News☐ Tutorials☐ UncategorizedAuthorβ€” No Change β€”CommentsDo not allowβ–ΎStatusβ€” No Change β€”PingsDo not allowβ–ΎStickyβ€” No Change β€”2UpdateCancel3Set Comments + Pings to β€œDo not allow”, then UpdateOnly 20 posts show per page by default. Raise β€œNumber of items per page” in Screen Options (top right) to edit up to 999 at once.
Bulk Edit changes the comment status on every selected post at once.

Now repeat the same steps under Pages β†’ All Pages and for any custom post type that shows a Comments field in Bulk Edit (portfolios, docs, events and so on). If you have more posts than fit on one screen, move to the next page of results and repeat.

Good to know:

  • Bulk Edit only closes comments. Existing comments stay visible under each post until you hide or delete them (Section 11).
  • On very large sites, selecting 999 posts can time out on cheap hosting. Work in batches of 200–300, or use the SQL or WP-CLI method in Section 9.
  • Media files aren’t in the Posts list. They’re covered in Section 10.

How to Disable Comments on Specific Pages in WordPress

Maybe you want comments on blog posts but not on your Contact, About, Pricing or Checkout pages. You have three good options.

Option 1: Quick Edit (fastest)

  1. Go to Pages β†’ All Pages (or Posts β†’ All Posts).
  2. Hover over the page title and click Quick Edit.
  3. Uncheck Allow Comments (and Allow Pings).
  4. Click Update.

Option 2: The Block Editor

Open the page in the editor, find Discussion in the right-hand settings sidebar, set Comment status to Closed, and click Save or Update. There’s a full walkthrough with a screenshot in Section 12.

Option 3: Disable Comments on All Pages but Keep Them on Posts (Code)

If you want every page closed permanently, even ones your team creates later, this snippet removes comment support from the Page post type and forces comments closed on pages. Posts are untouched. (See Section 8 for where to paste PHP safely.)

<?php
// Disable comments on Pages only. Posts keep their comments.
add_action( 'init', function () {
	remove_post_type_support( 'page', 'comments' );
	remove_post_type_support( 'page', 'trackbacks' );
}, 100 );

add_filter( 'comments_open', function ( $open, $post_id ) {
	return 'page' === get_post_type( $post_id ) ? false : $open;
}, 20, 2 );

add_filter( 'pings_open', function ( $open, $post_id ) {
	return 'page' === get_post_type( $post_id ) ? false : $open;
}, 20, 2 );

To close comments only on a handful of specific pages or posts, target them by ID instead. You’ll find a page’s ID in the URL when you edit it (post.php?post=12&action=edit).

<?php
// Close comments on specific pages or posts by ID (e.g. Contact, About, Checkout).
add_filter( 'comments_open', function ( $open, $post_id ) {
	$no_comments = array( 12, 45, 78 ); // Replace with your own IDs.
	return in_array( (int) $post_id, $no_comments, true ) ? false : $open;
}, 20, 2 );

How to Disable Comments Using a WordPress Plugin

If you’d rather not touch settings post by post or write code, a plugin gives you one sitewide switch that also covers things the built-in settings miss, such as the admin menu, the REST API, XML-RPC and existing comments.

Disable Comments Plugin

The free by WPDeveloper is the most popular option, with more than one million active installations and regular updates. If you’ve ever searched for a “WP disable comments” plugin, this is the one most people end up with. Here’s how to use it:

  1. Go to Plugins β†’ Add New Plugin, search for Disable Comments, then install and activate it.
  2. Open the plugin’s settings screen from your dashboard menu.
  3. Choose Everywhere to disable all comments in WordPress, or On certain post types to pick Posts, Pages, Media or custom post types individually.
  4. Save your settings. The plugin removes comment forms, hides the Comments menu and admin bar icon, and blocks comments that arrive through XML-RPC and the REST API.
  5. Optionally, open the Delete Comments tab to remove existing comments by type. Deletion is permanent, so back up your database first.

Three details make it a solid choice in 2026:

  • WooCommerce-aware: since version 2.9.0, product reviews are a separate setting, so you can close or keep reviews independently of other comments.
  • Notes-aware: its “Enable Certain Comment Types” setting can keep the WordPress 6.9+ editor Notes working while public comments are off.
  • Built for scale: it supports Multisite (network-wide or per-site settings) and includes WP-CLI commands.

Other Useful Comment Management Plugins

Not ready to turn comments off completely? These plugins help you manage, filter or replace them instead:

Plugin What it does Best for
Akismet Anti-spam Checks every comment against a global spam database and filters junk automatically. Free for personal sites; commercial sites need a paid plan. Blogs that keep comments on
Antispam Bee Free, privacy-friendly spam filter that needs no account or API key. GDPR-conscious sites in Europe
WPCode or Code Snippets Lets you add the PHP snippets from this guide without editing theme files, with an on/off toggle per snippet. Non-developers who want the code method
Built-in WooCommerce settings Turns product reviews on or off store-wide (WooCommerce β†’ Settings β†’ Products). Stores that want reviews off

A plugin is the right call if several people manage your site and you want a visible on/off switch. If you prefer fewer plugins, the code method below does the same job with zero overhead.

How to Disable Comments Using Custom PHP Code

Want to disable comments without a plugin? A small piece of PHP can disable comments globally, switching off comments, pingbacks and trackbacks across the whole site, hide old comments, and clean the comment screens out of your dashboard. It’s lightweight, version-control friendly and can’t be “accidentally” deactivated by a client.

Where to Add the Code

You have three safe places to put it. Pick one:

  1. A must-use plugin (recommended). Create a folder called mu-plugins inside wp-content (if it doesn’t exist), then create a file named disable-comments.php in it. WordPress loads every file in that folder automatically, it survives theme changes, and it can’t be deactivated from the Plugins screen.
  2. Your child theme’s functions.php. Fine if you’ll keep the same theme. Always use a child theme, because a parent theme update overwrites its functions.php.
  3. A code snippets plugin such as WPCode or Code Snippets, if you’d rather not use FTP or a file manager.
wp-content/
└── mu-plugins/
    └── disable-comments.php   ← paste the snippet here

The Complete Disable-Comments Snippet

Paste this into wp-content/mu-plugins/disable-comments.php. It’s written for WordPress 6.x and 7.x, works with both classic and block themes, and leaves the WordPress 6.9+ editor Notes alone.

<?php
/**
 * Plugin Name: Disable Comments Sitewide
 * Description: Closes comments and pings, hides old comments, cleans up the admin.
 *              Keeps WordPress Notes working.
 * Version:     1.0.0
 * Author:      aThemeArt
 */

defined( 'ABSPATH' ) || exit;

/**
 * Post types that should KEEP comments.
 * Example: return array( 'product' ); keeps WooCommerce product reviews.
 */
function atheme_keep_comments_on() {
	return array();
}

/**
 * Helper: should comments be disabled for this post?
 */
function atheme_comments_disabled_for( $post_id = null ) {
	$post_type = get_post_type( $post_id );
	return ! ( $post_type && in_array( $post_type, atheme_keep_comments_on(), true ) );
}

// 1. Close comments and pings everywhere (front end, REST API, XML-RPC, wp-comments-post.php).
function atheme_close_comments( $open, $post_id ) {
	return atheme_comments_disabled_for( $post_id ) ? false : $open;
}
add_filter( 'comments_open', 'atheme_close_comments', 20, 2 );
add_filter( 'pings_open', 'atheme_close_comments', 20, 2 );

// 2. Hide existing comments in classic AND block themes.
add_filter( 'comments_array', function ( $comments, $post_id ) {
	return atheme_comments_disabled_for( $post_id ) ? array() : $comments;
}, 20, 2 );

add_filter( 'get_comments_number', function ( $count, $post_id ) {
	return atheme_comments_disabled_for( $post_id ) ? 0 : $count;
}, 20, 2 );

// 3. Remove comment and trackback support (removes the Discussion panel and Comments column).
add_action( 'init', function () {
	foreach ( get_post_types() as $post_type ) {
		if ( in_array( $post_type, atheme_keep_comments_on(), true ) ) {
			continue;
		}
		if ( post_type_supports( $post_type, 'comments' ) ) {
			remove_post_type_support( $post_type, 'comments' );
			remove_post_type_support( $post_type, 'trackbacks' );
		}
	}
}, 100 );

// 4. Clean up the dashboard when no post type keeps comments.
if ( empty( atheme_keep_comments_on() ) ) {

	// Remove the Comments menu and block direct access to the screen.
	add_action( 'admin_menu', function () {
		remove_menu_page( 'edit-comments.php' );
	} );

	add_action( 'admin_init', function () {
		global $pagenow;
		if ( 'edit-comments.php' === $pagenow ) {
			wp_safe_redirect( admin_url() );
			exit;
		}
	} );

	// Remove the comments bubble from the admin bar.
	add_action( 'admin_bar_menu', function ( $wp_admin_bar ) {
		$wp_admin_bar->remove_node( 'comments' );
	}, 999 );

	// Remove the Recent Comments widget.
	add_action( 'widgets_init', function () {
		unregister_widget( 'WP_Widget_Recent_Comments' );
	} );
}

Here’s what each part does, so you can trim it to fit your site:

Hook What it does
comments_open / pings_open Tells WordPress every post is closed to comments and pings. Core checks these filters before accepting a comment from the form, the REST API, XML-RPC or a trackback, so this one filter closes every door.
comments_array Returns an empty list to comments_template(), so classic themes display no existing comments.
get_comments_number Reports zero comments. Block themes skip the Comments block when comments are closed and the count is zero, and classic themes stop printing “Comments are closed” and “Leave a comment” links.
remove_post_type_support() Removes the Discussion panel, the Comments meta box and the Comments column from the post list for every post type.
admin_menu / admin_init Removes the Comments menu and redirects anyone who opens edit-comments.php directly.
admin_bar_menu Removes the speech-bubble comments icon from the admin bar.
widgets_init Unregisters the legacy Recent Comments widget.

You can read the official reference for the in the WordPress Developer Resources if you want to see exactly where core applies it.

Keeping WooCommerce reviews? Change the atheme_keep_comments_on() function at the top of the file so it returns the product post type. Reviews stay open, the Comments menu stays available for moderating them, and everything else is closed:

<?php
function atheme_keep_comments_on() {
	return array( 'product' ); // Keep WooCommerce product reviews open.
}

The Short Version (Four Lines)

If you only need to close and hide comments on the front end, and don’t care about cleaning up the dashboard, this compact version is enough:

<?php
// Close comments and pings on every post, page and attachment.
add_filter( 'comments_open', '__return_false', 20, 2 );
add_filter( 'pings_open', '__return_false', 20, 2 );

// Hide any comments that already exist.
add_filter( 'comments_array', '__return_empty_array', 20, 2 );
add_filter( 'get_comments_number', '__return_zero', 20, 2 );

A note on older snippets: many tutorials still tell you to remove a dashboard box called dashboard_recent_comments. That box was merged into the Activity widget back in WordPress 3.8, so the line does nothing on a modern site. Once your comments are closed and cleared, the Activity widget simply has no comments to show.

Before you save: a single typo in PHP can take your site down with a fatal error or the dreaded WordPress white screen of death. Edit over FTP or your host’s file manager (not the built-in theme editor) so you can delete or rename the file instantly if something goes wrong.

Looking for more ways to customize WordPress without plugins? Browse our collection of useful WordPress code snippets.

How to Disable Comments Using phpMyAdmin (and WP-CLI)

Working at the database level is the fastest way to disable comments on thousands of posts, and the only way when your admin area is broken or painfully slow. You’ll find phpMyAdmin in your hosting control panel (cPanel, Plesk, hPanel and most others).

Back up the database first. SQL changes can’t be undone with a click. Your host’s backup tool works, or use one of these WordPress database plugins to back up and optimize your tables before and after.

Also check your table prefix. Open wp-config.php and look for $table_prefix. The queries below use the default wp_; if yours is something like wp7x_, change every table name to match.

Step 1: Stop Comments on Future Posts

Open phpMyAdmin, select your WordPress database, click the SQL tab, paste this query and click Go. It’s the database version of unchecking the boxes in Settings β†’ Discussion.

-- Turn off comments and pings for all FUTURE posts.
-- Replace "wp_" with your table prefix from wp-config.php.
UPDATE wp_options
SET option_value = 'closed'
WHERE option_name IN ('default_comment_status', 'default_ping_status');

Step 2: Close Comments on All Existing Content

This closes comments and pings on every post, page and media file in one query, the equivalent of bulk editing your whole site at once. product is deliberately left out of the list so WooCommerce reviews keep working; add it if you want reviews closed too.

-- Close comments and pings on every EXISTING post, page and media file.
UPDATE wp_posts
SET comment_status = 'closed',
    ping_status    = 'closed'
WHERE post_type IN ('post', 'page', 'attachment');

-- Keeping WooCommerce reviews? Leave 'product' out of the list above (as shown).

Step 3: Check What’s in Your Comments Table

Here’s the part almost every tutorial gets wrong. The wp_comments table doesn’t only hold visitor comments. WooCommerce stores product reviews and order notes there, and WordPress 6.9+ stores editor Notes there too. Run this query first to see what you have:

-- See what is actually stored in your comments table before deleting anything.
SELECT comment_type, COUNT(*) AS total
FROM wp_comments
GROUP BY comment_type
ORDER BY total DESC;
What is stored in the WordPress wp_comments tableDiagram of the wp_comments table grouped by comment_type. Visitor comments (comment or empty) and pingbacks or trackbacks are safe to delete. WooCommerce product reviews (review) should be kept if you sell products. WooCommerce order notes (order_note) must never be deleted. Editor Notes (note, WordPress 6.9 and later) are private team feedback and should be kept.One table, many jobs: what lives in wp_commentsDelete by comment_type, never the whole table.comment_typeWhat it isShown publicly?Safe to delete?comment or ”Visitor commentsEmpty type = saved before WordPress 5.5Yesβœ“ Deletepingback / trackbackLink notificationsMostly spam on modern sitesYesβœ“ DeletereviewWooCommerce product reviewsStar ratings and social proof on product pagesYes⚠ Keeporder_noteWooCommerce order notesPayment, refund and status history for ordersNo (admin only)βœ• NevernoteEditor Notes (WordPress 6.9+)Private block-level feedback between your teamNo (editor only)⚠ Keep
Never empty or truncate wp_comments on a WooCommerce site. Delete by comment type instead.

Step 4: Delete Only Real Comments (Optional)

If you want old comments gone for good, this deletes only visitor comments, pingbacks and trackbacks, along with their metadata, and resets the comment counters. Product reviews, order notes and editor Notes are untouched. (The empty '' type covers comments saved before WordPress 5.5, when the default type was blank.)

-- Permanently delete ONLY visitor comments, pingbacks and trackbacks.
-- Never touches WooCommerce reviews/order notes or editor Notes.

-- 1. Remove the comment meta first.
DELETE FROM wp_commentmeta
WHERE comment_id IN (
    SELECT comment_ID FROM wp_comments
    WHERE comment_type IN ('comment', '', 'pingback', 'trackback')
);

-- 2. Remove the comments themselves.
DELETE FROM wp_comments
WHERE comment_type IN ('comment', '', 'pingback', 'trackback');

-- 3. Reset the cached comment counters.
UPDATE wp_posts
SET comment_count = 0
WHERE post_type IN ('post', 'page', 'attachment');

Clear your page cache afterward so visitors see the change right away.

Bonus: Disable All Comments in WordPress With WP-CLI

If your host gives you SSH access, WP-CLI does everything above with less risk of typos and without touching table prefixes. It’s the go-to for agencies managing dozens of sites. These commands use the built-in wp comment command and wp post update:

# 1. Close comments and pings for all future posts
wp option update default_comment_status closed
wp option update default_ping_status closed

# 2. Close comments and pings on every existing post, page and media file
wp post list --post_type=post,page,attachment --post_status=any --format=ids \
  | xargs -r -n 200 wp post update --comment_status=closed --ping_status=closed

# 3. See how many comments you have, then delete visitor comments and pings permanently
wp comment count
wp comment list --type=comment --format=ids | xargs -r -n 200 wp comment delete --force
wp comment list --type=pings --format=ids | xargs -r -n 200 wp comment delete --force

# 4. Check whether media attachment pages are enabled (0 = off, 1 = on)
wp option get wp_attachment_pages_enabled

--force deletes permanently; leave it off to send comments to the Trash instead. Because --type=comment and --type=pings only match visitor comments and pings, WooCommerce data and Notes are left alone.

How to Disable Comments on WordPress Media Attachments

Every image, PDF or video you upload is technically a post (of type attachment) with its own comment status. On older sites, each one may also have its own “attachment page” with a comment form, which is a favorite target for spam bots and a source of thin, low-value pages in search results.

First, check whether attachment pages are even on. Since WordPress 6.4, new installs redirect attachment URLs straight to the file, so there’s no page for comments to appear on. Sites that existed before 6.4 keep attachment pages switched on. To check, visit yoursite.com/?attachment_id=123 (use the ID of any media item): if you land on the raw image or file, attachment pages are off. With WP-CLI, wp option get wp_attachment_pages_enabled returns 0 (off) or 1 (on). SEO plugins such as Yoast SEO and Rank Math can also redirect attachment URLs to the file.

If attachment pages are on, use any of these methods to disable media comments:

  • Plugin: in Disable Comments, choose On certain post types and tick Media.
  • SQL: the query in Step 2 of Section 9 already includes attachment.
  • Code: paste this snippet to close comments and pings on media only:
<?php
// Disable comments and pings on media attachment pages.
function atheme_close_media_comments( $open, $post_id ) {
	return 'attachment' === get_post_type( $post_id ) ? false : $open;
}
add_filter( 'comments_open', 'atheme_close_media_comments', 20, 2 );
add_filter( 'pings_open', 'atheme_close_media_comments', 20, 2 );

How to Hide Existing Comments in WordPress

Closing comments stops new ones. It does nothing to the comments already published, and the block editor even says so: “Existing comments remain visible.” So once comments are closed, you need to decide what happens to the old ones. You have three choices.

Close, hide or delete WordPress comments: what each one doesThree columns. Close: stops new comments, old comments stay visible, fully reversible. Hide: stops showing old comments on the front end but keeps them in the database, reversible. Delete: removes comments permanently, frees database space, not reversible without a backup.Close vs. hide vs. delete1. Closeβœ“ Stops new commentsβœ• Old comments stay visibleβœ“ Data kept in databaseβœ“ Fully reversibleHowSettings, Bulk Edit, Editor,comments_open filter2. Hideβœ“ Front end shows nothingβœ“ No β€œComments are closedβ€βœ“ Data kept in databaseβœ“ ReversibleHowUnapprove, or thecomments_array snippet3. Deleteβœ“ Gone from front endβœ“ Smaller databaseβœ• Data removed foreverβœ• Needs a backup to undoHowComments β†’ Trash β†’ Empty,plugin tool, SQL or WP-CLI
Closing, hiding and deleting comments are three different actions. Most sites close comments and then either hide or delete the old ones.

Option 1: Delete Old Comments From the Dashboard

  1. Go to Comments in your dashboard.
  2. Tick the checkbox in the table header to select all comments on the page (use Screen Options to show more per page).
  3. Choose Move to Trash from Bulk actions and click Apply.
  4. Open the Trash tab and click Empty Trash. Do the same under the Spam tab with Empty Spam.

If you skip the last step, WordPress permanently deletes trashed comments automatically after 30 days. For thousands of comments, the Delete Comments tab in the Disable Comments plugin, the SQL in Section 9 or WP-CLI is much faster.

Option 2: Unapprove Comments (Hide but Keep)

If you want comments off the front end but still on record, select them on the Comments screen and choose Unapprove from Bulk actions. Unapproved comments move to the Pending list and are never shown to visitors. You can approve them again at any time.

Option 3: Hide All Comments With Code (No Deleting)

This snippet hides every existing comment on the front end while keeping your data untouched. It works in classic themes, which load comments.php, and in block themes, which use the Comments block. It also removes the “Comments are closed” message in most themes.

<?php
// Hide existing comments on the front end WITHOUT deleting them.
// Works with classic themes (comments_template) and block themes (Comments block).
add_filter( 'comments_array', '__return_empty_array', 20, 2 );
add_filter( 'get_comments_number', '__return_zero', 20, 2 );

Remove the snippet and every comment reappears exactly as it was. It’s ideal when a client says “hide the comments for now, we might want them back.”

Don’t Forget Widgets and Blocks

Old comments can still show up outside the post itself. Check these places:

  • Appearance β†’ Widgets: remove the Latest Comments block or the legacy Recent Comments widget from sidebars and footers.
  • Site Editor (block themes): look for a Latest Comments block or a Comments Count in template parts, headers and footers.
  • Post meta lines: some themes print “3 Comments” next to the date. The get_comments_number filter above hides these in most themes.

How to Disable Comments in WordPress Using Gutenberg

If you’re wondering how to turn off comments while you write, the block editor (Gutenberg) has a per-post switch. And if you use a block theme, the editor also controls where the comments section appears on your site.

Turn Off Comments on One Post or Page

  1. Open the post or page in the editor.
  2. Make sure the settings sidebar is open (click the panel icon at the top right) and the Post or Page tab is selected.
  3. Click the value next to Discussion (it shows Open, Comments only, Pings only or Closed).
  4. Under Comment status, choose Closed. Uncheck Enable pingbacks & trackbacks too.
  5. Click Save or Update.
Turning off comments for one post in the WordPress block editorMockup of the block editor. In the Post settings sidebar, the Discussion row is clicked and a popover shows Comment status with two options: Open, visitors can add new comments and replies; and Closed, visitors cannot add new comments or replies and existing comments remain visible. Closed is selected.W+PreviewSaveOur Spring CollectionIs LivePostBlockStatusDraftPublishImmediatelySlug/spring-collectionAuthoradminDiscussionClosedDiscussionΓ—COMMENT STATUSOpenVisitors can add new comments and replies.ClosedVisitors cannot add new comments or replies.Existing comments remain visible.Enable pingbacks & trackbacks12Can’t see β€œDiscussion”?The post type doesn’t support comments,or a theme or plugin removed the panel.Use Quick Edit or a sitewide method.
In the block editor, click Discussion in the sidebar and set Comment status to Closed.

If you don’t see a Discussion row, the post type doesn’t support comments, or a theme or plugin has removed the panel. In older versions of WordPress, the same option lived in a separate Discussion panel with an Allow comments checkbox.

Remove the Comments Block From Block Theme Templates

If you use a block theme such as Twenty Twenty-Five, the comments area is just a block inside a template, and you can delete it visually:

  1. Go to Appearance β†’ Editor β†’ Templates.
  2. Open the Single Posts template (and then Pages, if it has one).
  3. Open List View (the three-line icon at the top left) and select the Comments block. It wraps the Comments Title, Comment Template, pagination and Comment Form blocks.
  4. Press the three-dot menu and choose Delete, then click Save.

This removes the comment section from the design, but it doesn’t close comments in the database. Bots can still post to wp-comments-post.php if comments are open, so combine it with Settings and Bulk Edit or a sitewide method.

What About WordPress Notes?

WordPress 6.9 added Notes: private, block-level feedback your team leaves inside the editor, a bit like comments in Google Docs. WordPress 7.0, released in May 2026, made them more useful with email notifications for mentions and a suggestions mode, as covered in DreamHost’s WordPress 7.0 overview.

Under the hood, Notes are saved in the same wp_comments table with the comment type note, but they never appear on the front end. Two practical consequences:

  • Closing comments doesn’t break Notes. Core allows Notes even when a post’s discussion is closed, so Settings, Bulk Edit and the comments_open snippet in this guide are all safe.
  • Heavy-handed blocking can break them. If a plugin blocks the REST API comments endpoint entirely, the editor can’t save Notes. If you see a “Comments are disabled” error when adding a Note, look for a setting that allows the note comment type (Disable Comments calls it “Enable Certain Comment Types”). And never delete rows of type note from the database.

How to Disable Comments in WordPress Themes and Page Builders

Sometimes the comment form is gone but your theme still prints a “Comments” heading, an empty box or a “Comments are closed” notice. That’s a template issue, not a settings issue. Here’s how to handle each type of theme and builder.

Classic Themes: Remove comments_template()

Classic themes load the comments section with comments_template(), usually inside single.php, page.php or a template part such as template-parts/content-single.php. Copy that file into your child theme and delete the call:

<?php
// Inside single.php or page.php of your CHILD theme, find this block…
if ( comments_open() || get_comments_number() ) :
	comments_template();
endif;

// …and delete it (or comment it out) to remove the comments section completely.

Don’t edit the parent theme directly; the next update will overwrite your change. If you’d rather not edit templates at all, the get_comments_number filter from Section 11 makes most themes skip the comments section automatically.

Theme Options and the Customizer

Many popular themes add their own comment toggles. Before writing code, check Appearance β†’ Customize (look under Blog, Single Post or Layout) and your theme’s own options panel.

Elementor, Divi and Other Page Builders

Page builders often replace your theme’s single post template, so the comments area lives inside the builder:

  • Elementor: open Templates β†’ Theme Builder, edit your Single Post template, and delete the Post Comments widget. Pages built with Elementor’s canvas or full-width templates usually show no comments at all.
  • Divi: open Divi β†’ Theme Builder, edit the template assigned to posts, and remove the Comments module. Also check Divi’s Theme Options for comment-related layout toggles.
  • Beaver Builder, Bricks, Oxygen and others: look for a Comments element or module in your single post template and remove it.

Still choosing a builder? Our comparison of Elementor, Gutenberg and Divi for WooCommerce covers how each one handles templates like this.

WooCommerce: Product Reviews Are Comments

On a WooCommerce store, product reviews are WordPress comments with the type review, attached to the product post type. That has two important effects:

  • A sitewide “disable all comments” snippet or plugin setting will also switch off your reviews and star ratings unless you exclude product.
  • To turn off reviews only, go to WooCommerce β†’ Settings β†’ Products and uncheck Enable product reviews. That hides the Reviews tab and the review form store-wide.

To remove only the Reviews tab while keeping review data in the database, use this filter:

<?php
// WooCommerce: remove the Reviews tab from single product pages.
add_filter( 'woocommerce_product_tabs', function ( $tabs ) {
	unset( $tabs['reviews'] );
	return $tabs;
}, 98 );

Reviews are some of the strongest social proof a store has, so think twice before switching them off. If you’re building out a store, see our list of essential WooCommerce plugins for better ways to collect and display them.

How to Remove the Comments Section From Your WordPress Website

“Disable comments” and “remove the comments section” sound the same, but they’re different jobs. Disabling stops submissions. Removing the comments section means no trace of comments anywhere: not on the front end, not in the dashboard, not in feeds, not in HTTP headers. If you want to remove the comment section in WordPress completely, here’s the checklist for a fully comment-free site.

Every way a comment can reach a WordPress site, and the filter that closes themFour entry points: the comment form posting to wp-comments-post.php, the REST API comments endpoint, XML-RPC including pingbacks, and trackbacks through wp-trackback.php. All four check comments_open or pings_open, so returning false from those filters blocks new comments everywhere. Existing comments are not removed and must be hidden or deleted separately.Four doors, one lockSpam bots rarely use your visible form. They post straight to these endpoints.Comment form/wp-comments-post.phpREST API/wp-json/wp/v2/commentsXML-RPC (incl. pingbacks)/xmlrpc.phpTrackbacks/wp-trackback.phpcomments_openpings_openreturn false(Settings, Bulk Edit, pluginor snippet all set this)No new comments,pingbacks ortrackbacksBut closing is not removing:comments that already exist stay visible until you hide them (Section 11) or delete them (Sections 9 and 11).
Comments can arrive through four endpoints. Closing comments with comments_open and pings_open blocks all of them, but old comments still need hiding or deleting.
  • Future posts: Settings β†’ Discussion boxes unchecked (Section 4).
  • Existing posts, pages and media: closed with Bulk Edit, SQL or WP-CLI (Sections 5 and 9).
  • Old comments: deleted, unapproved or hidden (Section 11).
  • Templates: Comments block, comments_template() or builder widget removed (Section 13).
  • Widgets: Latest Comments and Recent Comments removed from sidebars and footers.
  • Dashboard: Comments menu, admin bar icon and Discussion panels removed (snippet in Section 8 or the plugin).
  • Feeds and pingbacks: comment feeds, the X-Pingback header and XML-RPC pingback methods switched off (snippet below).
  • Avatars: Show Avatars unchecked in Settings β†’ Discussion if you no longer need them.
  • Cache: page cache, server cache and CDN purged so visitors see the new version.

The PHP snippet in Section 8 covers the dashboard. This extra snippet finishes the job by removing comment feeds and the pingback endpoint. Add it to the same mu-plugin file:

<?php
// Remove the sitewide comments feed link from <head>.
add_filter( 'feed_links_show_comments_feed', '__return_false' );

// Send comment feed requests to the homepage.
add_action( 'template_redirect', function () {
	if ( is_comment_feed() ) {
		wp_safe_redirect( home_url( '/' ), 301 );
		exit;
	}
} );

// Stop advertising the pingback endpoint.
add_filter( 'wp_headers', function ( $headers ) {
	unset( $headers['X-Pingback'] );
	return $headers;
} );

// Remove XML-RPC pingback methods (used in pingback spam and DDoS reflection).
add_filter( 'xmlrpc_methods', function ( $methods ) {
	unset( $methods['pingback.ping'], $methods['pingback.extensions.getPingbacks'] );
	return $methods;
} );

If other plugins or your theme use XML-RPC (for example, the Jetpack plugin or the WordPress mobile apps on some setups), removing only the pingback methods, as above, is safer than disabling xmlrpc.php entirely.

Common WordPress Comment Problems and How to Fix Them

These are the issues that come up most often after people try to turn off comments in WordPress, along with the fix for each.

1. The Comment Form Still Shows After I Changed the Settings

The Discussion setting only applies to new posts. Every post published before the change keeps its own open status. Close existing posts with Bulk Edit (Section 5) or SQL/WP-CLI (Section 9). To find every item still open, run this in phpMyAdmin:

-- Find published content that still accepts comments or pings.
SELECT ID, post_title, post_type, comment_status, ping_status
FROM wp_posts
WHERE post_status IN ('publish', 'inherit')
  AND (comment_status = 'open' OR ping_status = 'open')
ORDER BY post_type, ID;

2. “Comments Are Closed” Still Appears Under Posts

Your theme prints this message when a post has comments closed but still has old comments. Delete or unapprove the old comments, or add the get_comments_number filter from Section 11, which tells the theme there’s nothing to show. As a last resort, remove comments_template() in a child theme.

3. Old Comments Are Still Visible

That’s expected: closing comments never hides or deletes the ones already published. Choose hide, unapprove or delete in Section 11.

4. Spam Comments Keep Arriving After I Disabled Comments

When comments are truly closed, WordPress rejects every submission with “Sorry, comments are closed for this item.” If spam still lands in your queue, something is still open. The usual culprits are old media attachments, a custom post type you didn’t bulk edit, or pingbacks left on. Run the query above, close whatever it finds, and switch off pingbacks. The sitewide snippet in Section 8 removes the guesswork by closing everything at once.

5. Comments Turn Back On for New Posts

Some importers, page builders, mobile apps and REST API integrations set comment_status to open when they create a post, ignoring your default. A plugin may also reset the option. A code-level method (the plugin or the mu-plugin snippet) overrides the stored value every time, so it’s the reliable fix.

6. My WooCommerce Product Reviews Disappeared

A sitewide method closed comments on the product post type, which closes reviews too. In the plugin, untick Products. In the snippet, return array( 'product' ) from atheme_keep_comments_on(). Then check that Enable product reviews is still ticked in WooCommerce β†’ Settings β†’ Products.

7. Notes in the Block Editor Stopped Saving

A plugin or snippet is blocking the REST API comments endpoint. Allow the note comment type in your plugin’s settings, or replace endpoint blocking with the comments_open approach, which leaves Notes alone.

8. My Site Crashed After Adding the Code

Connect with FTP or your host’s file manager and rename wp-content/mu-plugins/disable-comments.php to disable-comments.php.off, or remove the snippet from functions.php. Your site comes straight back. WordPress may also email the admin address a recovery mode link that lets you log in and fix the problem. Most crashes come from a missing semicolon or from pasting the opening <?php tag twice into an existing file.

9. Comment Counts Still Show Old Numbers

WordPress caches each post’s comment total in the comment_count column. After deleting comments directly in the database, run Step 4 of Section 9 or wp comment recount with WP-CLI to refresh the totals.

10. Nothing Changed on the Front End

You’re almost certainly looking at a cached page. Purge your caching plugin, any server-level cache your host provides, and your CDN, then check in a private browser window.

Frequently Asked Questions (FAQs)

How do I permanently disable comments in WordPress?

Uncheck the comment options in Settings β†’ Discussion, close comments on all existing content with Bulk Edit, then delete or hide old comments. For a setting that can’t be undone by accident, use the Disable Comments plugin set to “Everywhere” or the mu-plugin snippet in Section 8, which overrides every post’s individual setting on every page load.

Can I disable comments on all WordPress posts at once?

Yes. Go to Posts β†’ All Posts, select everything, choose Edit from Bulk actions, set Comments to “Do not allow” and click Update. For very large sites, one SQL query in phpMyAdmin or one WP-CLI command closes comments on every post in seconds.

How do I remove the comment box from WordPress?

Closing comments removes the comment box in most themes, because themes only show the form when comments are open. If an empty comments area or heading remains, delete the Comments block from your block theme’s templates, remove the Post Comments widget in your page builder, or remove comments_template() in a child theme.

Can I disable comments on pages but keep them on posts?

Yes. New pages already start with comments closed in modern WordPress. To close older pages, bulk edit them under Pages β†’ All Pages. To lock pages permanently, use the pages-only snippet in Section 6 or choose “On certain post types β†’ Pages” in the Disable Comments plugin. Your blog posts keep their comments.

Does disabling comments delete existing comments?

No. Disabling comments only stops new ones. Every existing comment stays in your database and usually stays visible on the post. You need to delete, unapprove or hide old comments as a separate step.

How do I disable WordPress comments without a plugin?

Use Settings β†’ Discussion for future posts and Bulk Edit for existing posts; both are built into WordPress. For a sitewide, code-based switch, add the PHP snippet from Section 8 as a must-use plugin. Developers can also use SQL in phpMyAdmin or WP-CLI.

Can I disable comments on media files?

Yes. Sites created on WordPress 6.4 or later redirect attachment pages to the file itself, so media comments can’t appear. On older sites, close them with the media snippet in Section 10, the SQL query that includes attachment, or the Media option in the Disable Comments plugin.

How do I stop spam comments in WordPress?

If you want to keep comments, install an anti-spam plugin such as Akismet or Antispam Bee, switch off pingbacks and trackbacks, hold comments with links for moderation, add common spam words to Disallowed Comment Keys, and close comments on older posts automatically. If you don’t need comments at all, disabling them is the only method that stops spam completely.

Will disabling comments hurt my SEO?

Not on its own. Comments aren’t a direct ranking factor, and spammy or thin comments can hurt more than they help. Thoughtful comments can add useful long-tail text, so deleting a large number of high-quality comments may cause a small traffic dip on those posts. Focus on strong on-page SEO instead, and consider hiding rather than deleting valuable discussions.

Will disabling comments turn off WooCommerce product reviews?

Only if the method covers the product post type. Settings β†’ Discussion and Bulk Edit on Posts and Pages don’t affect products. A sitewide plugin setting or snippet does, unless you exclude products as shown in Section 8. Reviews can be turned on or off separately in WooCommerce β†’ Settings β†’ Products.

Will disabling comments break the WordPress Notes feature?

No, as long as you close comments rather than block the whole comments API. WordPress allows Notes on posts with discussion closed. Problems only appear when a plugin blocks the REST API comments endpoint or when someone deletes every row in the comments table.

How do I turn comments back on later?

Reverse the steps: re-check the boxes in Settings β†’ Discussion, bulk edit posts back to “Allow”, and deactivate the plugin or delete the snippet. Hidden or unapproved comments come straight back. Permanently deleted comments can only be restored from a backup.

Conclusion

Disabling comments in WordPress is easy once you know that it happens in layers. To recap:

  • Future posts: uncheck the three boxes in Settings β†’ Discussion.
  • Existing posts and pages: Bulk Edit to “Do not allow”, or one SQL/WP-CLI command for big sites.
  • Everything at once: the Disable Comments plugin or the mu-plugin snippet.
  • Old comments: hide, unapprove or delete them, but filter by comment type and never empty the whole table on a WooCommerce site.
  • Leftover UI: remove the Comments block, the builder widget or comments_template(), then purge your cache.

For most business sites and online stores, the best combination is the Settings change plus the mu-plugin snippet, with product excluded if you rely on reviews. For blogs, consider a middle ground: keep comments on posts, turn them off on pages and media, and close them automatically on older articles.

Once your comments are under control, take two minutes to check the rest of your site’s defenses with our free WordPress security audit tool. A comment-free site with outdated plugins is still an easy target.

Inspire us with your love!

Saiful Islam

By Saiful Islam

Saiful Islam, the founder of aThemeArt, is a successful freelancer, a father of two boys, and an enthusiast in coding, YouTube, and gaming. Connect with me on Twitter, Facebook, and Instagram to stay updated with my latest endeavors.

You can check also

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*