Tutorials

How to disable comments in WordPress

Comments are a good way to encourage discussions about the content on your site, but they’re not always wanted or needed. In this tutorial, you’ll learn how to disable comments on a single post or page in WordPress, across all content on your entire site, and on the places people tend to forget about, like media attachment pages. We’ll also look at how to close comments automatically on older posts, and how to remove comments from the administration panel completely, with or without a plugin.

The short version: to turn off comments on new posts, go to “Settings” → “Discussion” and uncheck “Allow people to submit comments on new posts”. To close them on the posts you already have, select them under “Posts” → “All Posts” and set “Comments” to “Do not allow” with bulk edit. Read on for pages, media and how to remove comments completely.

On a single post

  1. Log in to the administration panel on your site.
  2. Go to “Posts” → “All Posts”, and locate the post for which you want to disable comments in the list.
  3. Hover over the post, and click the “Quick Edit” link that appears below the title.
  4. Locate the checkbox labeled “Allow Comments”, and uncheck it.
  5. Click the “Update” button.

If you view your post now, the comment form should be gone, or replaced with a note that comments are closed. Any comments that were already on the post will still be visible, though. If you want to remove those as well, you can delete them on the “Comments” page in the administration panel.

You can also disable comments while you’re editing the post. Open the “Post” tab in the right sidebar, click “Open” next to “Discussion”, and select “Closed”.

On all posts

What if you want to disable comments not just on a single post, but on all posts on your entire site? Maybe you have been having issues with spam, or you’ve just decided that comments aren’t something you’re going to use going forward. WordPress has a setting for allowing comments on new posts, and you can combine it with bulk edit to disable comments on the posts you already have.

  1. Go to “Settings” → “Discussion”.
  2. Uncheck “Allow people to submit comments on new posts”. While you’re there, you can also uncheck “Allow link notifications from other blogs (pingbacks and trackbacks) on new posts”, since those are mostly used by spammers these days. Click the “Save Changes” button. Comments will now be disabled on new posts by default.
  3. Go to “Posts” → “All Posts”, select all of your posts, and open the Bulk Edit panel. Set “Comments” to “Do not allow”, and click the “Update” button.

If you have a lot of posts, increase the number of posts shown per page under “Screen Options” at the top of the screen, so you can select more of them at once.

On pages and media

New pages have comments turned off by default, so you only need to worry about pages you created with comments allowed. To close those, go to “Pages” → “All Pages” and use bulk edit the same way as for posts. Repeat it for any other post types on your site that have comments, like products or portfolio items.

Media is easier to miss. On older sites, every image and file you upload gets its own attachment page, and each of those pages can have its own comment form. Since nobody visits them on purpose, they’re a favorite target for spam bots.

To check whether your site has attachment pages, go to “Media” → “Library” and click an image. If the details window has a “View attachment page” link, they’re turned on. If it says “View media file”, they’re turned off, and there’s nothing to comment on. WordPress turns them off on all sites installed since WordPress 6.4, but sites that were set up before that keep them.

New uploads follow the “Allow people to submit comments on new posts” setting, so turning it off covers them. The media library doesn’t have bulk edit, though, so for files you’ve already uploaded, the snippet or the plugin below is the easiest way to close comments on them.

Closing comments automatically on older posts

If you want to keep comments on new posts, but stop the discussion once a post is no longer fresh, WordPress can close comments for you after a set number of days. This also cuts down on spam, since spam bots love old posts.

  1. Go to “Settings” → “Discussion”.
  2. Check “Automatically close comments on old posts”.
  3. In the “Close comments when post is how many days old” field, enter the number of days you want comments to stay open, like 14 or 30.
  4. Click the “Save Changes” button.

The setting applies to all of your posts right away, including the ones you published before you turned it on. It only covers posts, though, so pages, media and other post types keep their own settings.

Deleting existing comments

Closing comments stops new ones, but the comments you already have stay on your posts. To remove them without a plugin:

  1. Go to “Comments” → “All Comments”.
  2. Check the checkbox at the top of the list to select all comments on the page.
  3. Select “Move to Trash” in the “Bulk actions” menu, and click “Apply”.
  4. Repeat until the list is empty, then open the “Trash” view and click “Empty Trash”.

Comments in the trash are deleted for good after 30 days, or right away when you empty it. If you might want them back later, export your site under “Tools” → “Export” first.

Removing the comments section from a block theme

In a block theme like Twenty Twenty-Five, the comments section is a Comments block in your post template. When comments are closed and a post has no comments, the block hides itself, so there’s nothing to remove. If a post has old comments, though, they’re still shown below it.

To remove the section from every post, no matter what:

  1. Go to “Appearance” → “Editor” → “Templates”, and open the “Single Posts” template.
  2. Open the List View with the icon in the top left. In Twenty Twenty-Five, the comments section is inside two Group blocks, so expand those and select “Comments”.
  3. Open the block’s options menu (the three dots in the toolbar), select “Delete”, and click “Save”.

Twenty Twenty-Five only shows comments on posts, but some themes have them on pages too. If yours does, repeat it for the “Pages” template.

Turning comments off completely

The settings above close comments, but the “Comments” menu, the comments icon in the toolbar and any comments you already have are still around. If you want comments gone from your entire site, there are two ways to do it: with a plugin, or with a short code snippet.

With a plugin

The most popular plugin for this is Disable Comments, so that’s the one we’ll use. The plugin won’t delete your old comments, in case you want to make them visible again later. If you want to delete them, the plugin has a “Delete Comments” tool for that.

Here’s how to set it up:

  1. Log in to the administration panel on your site.
  2. Go to “Plugins” → “Add Plugin”. In the search field in the top right, type “Disable Comments” and hit the enter key.
  3. The “Disable Comments” plugin should be the top result. If the preview says it’s “By WPDeveloper”, you know it’s the right one. Click the “Install Now” button. When the button changes to “Activate”, click it again.
  4. Go to “Settings” → “Disable Comments”.
  5. Here, you can choose to disable comments “Everywhere”, or “On Specific Post Types” (like “Posts” and “Pages”). By default, the plugin also hides the comments you already have. If you want to keep showing them, turn on “Show Existing Comments”. Make your selection, and click the “Save Changes” button.

Comments are now disabled on your site! If you want to delete your existing comments as well, open the “Delete Comments” tab at the top of the plugin settings page. Deleted comments can’t be restored, so I recommend clicking “Download a CSV backup first” before you click “Delete Comments”.

Without a plugin

If you’d rather not install a plugin for this, you can get the same result with a few lines of code. Create a file called disable-comments.php in the wp-content/mu-plugins folder on your site (create the folder if it doesn’t exist), and paste in the following:

<?php
/**
* Plugin Name: Disable comments
* Description: Turns off comments and pings across the site.
*/
// Close comments and pings everywhere.
add_filter( 'comments_open', '__return_false', 20 );
add_filter( 'pings_open', '__return_false', 20 );
// Hide comments that were already published, in both classic and block themes.
add_filter( 'comments_array', '__return_empty_array', 20 );
add_filter( 'render_block_core/comments', '__return_empty_string' );
// Remove the comment feeds, and send anyone who visits one to the front page.
add_filter( 'feed_links_show_comments_feed', '__return_false' );
add_action(
'template_redirect',
function () {
if ( is_comment_feed() ) {
wp_safe_redirect( home_url(), 301 );
exit;
}
}
);
// Remove the Comments menu and the comments icon in the admin bar.
add_action(
'admin_menu',
function () {
remove_menu_page( 'edit-comments.php' );
}
);
add_action(
'admin_bar_menu',
function ( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'comments' );
},
100
);
// Send anyone who opens the Comments screen back to the dashboard.
add_action(
'admin_init',
function () {
global $pagenow;
if ( 'edit-comments.php' === $pagenow ) {
wp_safe_redirect( admin_url() );
exit;
}
}
);

Files in the mu-plugins folder are “must-use” plugins. WordPress loads them automatically, and they keep working when you switch themes. The snippet closes comments on every post, page and media file, hides the comments that are already there, turns off the comment feeds, and removes the comment screens from the administration panel. Your old comments are still in the database, so if you change your mind, delete the file and everything comes back.

What about Notes?

Notes, the editor feature that lets you and other users leave feedback on blocks, is built on top of comments. The Disable Comments plugin turns Notes off too. The snippet above leaves them alone, since Notes don’t check whether comments are open. If you’re using the plugin and want to keep Notes, here’s how to keep Notes working when comments are off.

Published November 2, 2026

Modified December 1, 2026