Disable Comments in WordPress Completely

Unchecking 'Allow comments' only affects new posts. Here's how to disable WordPress comments completely: post types, existing posts, admin, XML-RPC, REST.

WordPress turns comments on everywhere by default—every post, every page, every custom post type. For a blog built on discussion, great. For a business site, a portfolio, or a landing page, comments are pure liability: a spam magnet, an attack surface, and a steady trickle of admin work for zero benefit. The catch is that the obvious fix—unchecking “Allow comments”—barely does anything. Here’s how to actually remove them, completely and reversibly.

The essentials

  • Unchecking “Allow comments” only affects new posts—existing posts, the admin menu, the database and pingbacks all stay.
  • Full removal means: disable on post types, close existing, hide from admin, and block XML-RPC + REST comment endpoints.
  • The module works site-wide or per post type, so you can kill comments everywhere or only on pages while keeping them on the blog.
  • In site-wide mode, it also strips the X-Pingback header, unregisters the Recent Comments widget, and redirects edit-comments.php—closing the comment and pingback surface. The xmlrpc.php file itself stays reachable for its other methods.
  • It’s reversible: turn it off and everything comes back, with no leftover code. Only its own settings row stays, and that goes too if you uninstall the plugin with its delete-data option on. Only “Delete Comments” is permanent.

Why is unchecking “Allow comments” not enough?

Unchecking “Allow comments” in Settings → Discussion only changes the default for future posts. Every post already on your site keeps its comment status open, so it still accepts comments at the database level; the Comments menu stays in your admin, the wp_comments and wp_commentmeta tables remain, and pingbacks keep arriving through XML-RPC, WordPress’s older remote interface.

That last part matters beyond tidiness. Comment forms are a well-worn target for spam, XSS and injection attempts. “Disabling comments” halfway leaves all of that live.

Here’s where comments keep coming back—and what closes each gap:

Where comments lingerThe native settingWhat the module does
Existing postsDiscussion only affects new posts; old ones keep comment_status openCloses comments and pings on every existing post
Admin UIComments menu, columns and metabox stayHides the menu, columns, metabox and dashboard widget
Databasewp_comments and wp_commentmeta remainCan delete blog comments, pingbacks and trackbacks, then recount each post’s comments
XML-RPC pingbacksKeep workingFilters out the XML-RPC comment methods
REST APIThe /wp/v2/comments routes stay openRemoves those routes—nothing can list or post comments through them
HTML head / headersComment feed link and X-Pingback still emittedStrips the feed link and the X-Pingback header

What does completely removing comments actually require?

Completely removing WordPress comments takes seven steps: closing them on existing posts, removing comment support from your post types, hiding the comment screens in the admin, stripping the comment feed link and the X-Pingback header, unregistering the Recent Comments widget, and blocking the XML-RPC and REST comment endpoints. Doing it by hand in functions.php means seven chances to miss one.

  1. Close comments and pingbacks on all existing posts.
  2. Remove comment support from every (or selected) post type.
  3. Hide the Comments menu, dashboard widget, columns and metabox from the admin.
  4. Strip the comment feed link from your HTML head.
  5. Remove the X-Pingback header from responses.
  6. Unregister the Recent Comments widget.
  7. Block comment creation via XML-RPC and the REST API.

Miss any one and you’ve left a gap—an open endpoint, a lingering menu, a database still filling with spam. A dedicated module closes all seven at once.

How do you disable comments with Blaminhor Essentials?

To remove comments completely, switch off comment support across your post types, close comments on existing posts, hide the comment UI in the admin, and block the XML-RPC and REST endpoints. In Blaminhor Essentials, turning on the Disable Comments module does all of that at once—site-wide or per post type—and can optionally delete existing comments (blog comments, pingbacks and trackbacks).

The moment it’s on, comments are blocked site-wide: comments_open and pings_open return false, comment support is pulled from your post types, the feed link and X-Pingback header are stripped, and the Recent Comments widget is deregistered.

Illustration: a speech bubble struck through with a red "no" sign, surrounded by OFF toggles and small settings cards. Comments switched off. In the module itself, one screen holds the scope (site-wide or per post type), the hide-from-admin toggle, and the buttons to close or delete existing comments—no code, no functions.php surgery.

Site-wide or just some post types

You’re not stuck with all-or-nothing. Leave it in everywhere mode to disable comments across the whole site, or switch to per-post-type mode and pick exactly which types lose comments—kill them on pages and products while keeping them on blog posts, for instance.

Clean up the admin

With “Hide from Admin” (on by default), every trace of comments leaves your dashboard: the Comments menu disappears, comment columns vanish from post lists, the metabox is removed from the editor, the dashboard widget is gone, and visiting edit-comments.php bounces back to the dashboard. (In per-post-type mode, only the columns and metabox of the selected types go; the Comments menu stays for the others.)

Block the back doors

Two toggles—both on by default—close the endpoints the front end can’t see: the XML-RPC comment methods are filtered out, pingbacks are refused because pings are closed, and the REST API comment routes (/wp/v2/comments) are removed, so comments can neither be listed nor posted through REST. In per-post-type mode, the XML-RPC filter stays off and the REST routes stay up: only comment creation on the disabled types is refused.

Close, or delete, existing comments

  • Close existing comments runs a single database update setting comment_status and ping_status to closed on every post, and tells you how many it changed. It ignores the scope you chose: in per-post-type mode it still closes the types you left alone (reopen them from bulk edit if that happens).
  • Delete Comments permanently removes blog comments, pingbacks and trackbacks (with their metadata) from wp_comments and wp_commentmeta, for all post types or just one, and recounts each post’s comment_count. WooCommerce order notes and product reviews are never touched.

Can you turn comments back on later?

Yes—everything except deletion is reversible. Deactivate the Disable Comments module and WordPress returns to its stock behaviour: comments reopen, menus and widgets reappear, the XML-RPC and REST endpoints come back. The module works entirely through WordPress’s own hooks, so switching it off removes them all; only its own settings row stays in your database. Even that goes if you uninstall the plugin with its delete-data option on. If you’d only closed existing comments, those stay closed, but you can reopen any of them from the bulk-edit screen.

What do you gain by disabling comments?

Disabling comments completely shrinks your WordPress database, trims your attack surface, drops needless comment queries, and deletes a recurring moderation chore. For any site that doesn’t live on reader interaction, it’s one of the highest-value five-minute jobs you can do—and it’s reversible, except for deleting existing comments. If you do want discussion but not the spam that comes with it, keep comments on and let an invisible anti-spam field sort the bots out instead.

Disable Comments is one of the 26 modules in Blaminhor Essentials—free and open-source on WordPress.org.

Download Blaminhor Essentials

– blaminhor

FAQ

Is disabling comments good for security and performance?

Yes. Comment forms are a classic spam and injection target. Removing comments cuts that attack surface, stops spam from bloating wp_comments and wp_commentmeta, and removes comment queries and admin clutter you never use.

How do I disable comments without a plugin?

You can, but it takes seven separate edits in functions.php: closing comments on existing posts, removing comment support per post type, hiding the admin UI, stripping the feed link and X-Pingback header, unregistering the widget, and blocking XML-RPC and REST. Miss one and a gap stays open, which is why a dedicated module is safer.

How do I stop comment spam without disabling comments?

If you genuinely want discussion, keep comments on but add moderation: require approval before anything publishes, enable Akismet or a comparable anti-spam filter, add a honeypot or CAPTCHA, and close comments automatically on posts older than a set number of days. Disabling is only the right call when you never wanted comments at all.

Does disabling comments hurt SEO?

No. Comments can add fresh keyword-rich text, but spam-filled or empty comment sections do the opposite—thin content, spammy outbound links and slower pages. On a business site, portfolio or landing page that never hosts real discussion, removing comments is neutral to positive for SEO and trims your crawl surface.

How do I remove the 'Comments are closed' message?

Closing comments often leaves themes printing 'Comments are closed' where the form used to be. Removing comment support from the post type entirely—not just closing the thread—stops the comment template from rendering, so that line disappears. The Disable Comments module removes that support for you.

Will disabling comments delete my existing comments?

No, not unless you ask it to. Closing comments only stops new ones and hides the threads; your existing comments stay in the database untouched and reappear if you re-enable. Deleting them is a separate, deliberate action that asks for confirmation—because unlike everything else, wiping wp_comments is permanent.

blaminhor Building what's missing.

Comments