Most business sites do not want comments. Nobody leaves a thoughtful note under a services page, but bots find the form within days, and then you are moderating a queue of nonsense about payday loans forever.

The frustrating part is that the obvious setting only does half the job. Unticking the box in Settings > Discussion stops comments on posts you publish from that moment on. Everything already published keeps its comment form, pages keep theirs, and every image in your media library is quietly still accepting comments on its own attachment page.

So “disable comments” is really seven small jobs: future content, existing content, media attachments, the front-end form, the admin clutter, pingbacks, and the spam already sitting in the database. Here is all seven, with a code route and a plugin route, and my view on which to use.

Most of this is ticking boxes in the WordPress admin, and you can stop after Step 4 and be in a much better place than you started. The code section further down is for when you want it locked shut for good. Nothing here needs you to be a developer.

Before you start

Everything up to the code section is done from wp-admin and is reversible. The code route needs a way to put files on your web server: either SFTP, a secure way of copying files to and from the server using a free program like FileZilla, or the File Manager in your hosting panel, which does the same job in a browser. Either one also lets you rename a folder if something goes wrong, which is the escape hatch used later on.

Take a database backup before deleting comments. Closing comments is easy to undo. Deleting a few thousand of them is not, and if any of them turn out to have been genuine customer questions there is no way back without the backup.

One decision to make now: are you closing comments or removing them? They are different, and the section near the end covers why closing is usually the better first move.

Step 1: Stop comments on everything published from now on

Go to Settings > Discussion and untick Allow people to submit comments on new posts. While you are there, untick Allow link notifications from other blogs (pingbacks and trackbacks) on new posts as well.

The Discussion Settings screen, with Allow people to submit comments on new posts at the top

That is the default applied to new content. It changes nothing that already exists, which is the source of most of the confusion around this topic.

Step 2: Close comments on existing content, in bulk

Do this next, and do it before you add any code that removes comment support, because the bulk edit control only appears for post types that still declare support for comments. Add the code first and the dropdown vanishes, along with your quickest route.

In the admin, go to Posts > All Posts. Open Screen Options at the top right and set the number of items per page high enough to show everything (999 is fine on most sites). Tick the checkbox in the header row to select all, choose Edit from the Bulk actions dropdown, click Apply, set Comments to Do not allow, and click Update. Repeat on Pages, and on any custom post type that accepts comments.

If you have WP-CLI, the whole thing is one line. WP-CLI is the command line version of WordPress, which you reach by connecting to your server with SSH, and plenty of good hosts include it. If you have never opened a terminal, skip this block and the SQL one below it. The admin route above gets you to exactly the same place.

# Closes comments and pings on every post, page and attachment at once.
wp post list --post_type=any --post_status=any --format=ids \
  | xargs wp post update --comment_status=closed --ping_status=closed

There is a SQL route too, and it is the fastest option on a site with tens of thousands of posts. SQL is the language for talking to the database directly, usually through phpMyAdmin, the database editor most hosting panels include. There is no undo button here, so take that backup first.

-- Back up first. This has no WHERE clause, so it touches every row.
-- Change wp_ to your real table prefix.
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed';

I would use the admin or WP-CLI where I can. Direct SQL bypasses every hook WordPress would normally fire. A hook is the announcement WordPress makes when something happens, like “a post was just updated”, and plugins listen for those so they can react. Change the database behind WordPress’s back and nothing gets announced, so a caching or search plugin can be left holding stale data.

Step 3: Media attachments, the one everyone misses

Every file you upload becomes a post of type attachment, which is WordPress’s way of saying every image and PDF quietly gets a page of its own. That page inherits the comment setting in force when you uploaded the file. So a site with years of uploads has hundreds of attachment pages, each with a working comment form, none of which anyone ever looks at.

Spam bots do look at them. If you have closed comments everywhere and spam keeps arriving, attachment pages are almost always why.

The --post_type=any in the WP-CLI command above covers attachments already. The admin bulk edit does not, because the Media library has no bulk edit for comment status. If you are working from the admin only, the code route in the next section handles attachments along with everything else, which is one of the better reasons to use it.

Worth knowing: WordPress 6.4 added an option that makes attachment pages redirect to the file itself rather than rendering a page, and new installs get that behaviour by default. Sites created before then carry the old behaviour forward unless something changes it. If your attachment pages still load as pages, assume they still accept comments.

Step 4: Clear out the spam you already have

Go to Comments, click the Spam filter, and use Empty Spam to delete the lot in one go. Then check Pending and Bin and do the same.

On a badly overrun site the admin screen will time out trying to delete tens of thousands of rows. WP-CLI handles it without complaint:

# --force skips the bin and deletes outright.
wp comment delete $(wp comment list --status=spam --format=ids) --force

Resist the temptation to empty the comments table directly in phpMyAdmin with TRUNCATE wp_comments. It clears the comments out, but every post stores its own count of how many comments it has, and that count is left showing the old number. It also leaves rows in a second table, wp_commentmeta, pointing at comments that no longer exist, and nothing will ever tidy those up. Deleting through WordPress or WP-CLI keeps the counts and that extra data consistent.

The plugin route

The Disable Comments plugin is the well-established option. It turns everything off site wide from one settings screen, handles attachments, has a network-wide mode for multisite, and includes a tool to delete existing comments.

I would use it when someone other than me will maintain the site, when it is a multisite network, or when the client might want comments back on one section later and needs a screen rather than a developer. Those are real reasons and there is nothing wrong with taking them.

The trade-off is a plugin that loads on every request, needs updating, and is one more thing in the dependency list for a job that is genuinely about forty lines of code.

The code route, as a site-specific plugin

This is what I use on sites I look after. It does everything the plugin does for this particular job, with no update cycle and no settings screen to be changed by accident.

Put it in a small plugin rather than functions.php. A theme update wipes functions.php and takes the lot with it, and a plugin also means comments stay off when you change theme. Building small, single-purpose plugins like this is most of what custom plugin development actually is in practice.

Create /wp-content/plugins/site-no-comments/site-no-comments.php. In practice: connect over SFTP or open File Manager in your hosting panel, find the wp-content/plugins folder inside your site, make a folder called site-no-comments in it, and create a file called site-no-comments.php in that folder. Paste this in and save:

<?php
/**
 * Plugin Name: Site No Comments
 * Description: Removes comments from the front end and the admin, site wide.
 */

defined( 'ABSPATH' ) || exit;

// Report every post as closed to comments and pings, whatever is stored
// in the database. Priority 20 so it beats anything set earlier.
add_filter( 'comments_open', '__return_false', 20, 2 );
add_filter( 'pings_open',    '__return_false', 20, 2 );

// Hide comments that already exist, so old threads stop rendering
// without you having to delete them.
add_filter( 'comments_array', '__return_empty_array', 20, 2 );

// Drop the comment feed link from the <head>.
add_filter( 'feed_links_show_comments_feed', '__return_false' );

// Remove comment support from every post type that declares it, including
// attachments. This also removes the Discussion panel from the editor.
add_action( 'init', function () {
    foreach ( get_post_types( array(), 'names' ) as $post_type ) {
        if ( post_type_supports( $post_type, 'comments' ) ) {
            remove_post_type_support( $post_type, 'comments' );
            remove_post_type_support( $post_type, 'trackbacks' );
        }
    }
}, 100 );

// Send anyone who lands on the Comments screen back to the dashboard,
// including via a bookmarked URL.
add_action( 'admin_init', function () {
    global $pagenow;
    if ( 'edit-comments.php' === $pagenow ) {
        wp_safe_redirect( admin_url() );
        exit;
    }
} );

// Remove the Comments item from the admin sidebar.
add_action( 'admin_menu', function () {
    remove_menu_page( 'edit-comments.php' );
} );

// Remove the dashboard Activity widget, which is where recent comments live.
add_action( 'wp_dashboard_setup', function () {
    remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
} );

// Remove the speech bubble and its count from the admin bar.
add_action( 'wp_before_admin_bar_render', function () {
    global $wp_admin_bar;
    $wp_admin_bar->remove_node( 'comments' );
} );

Activate it from Plugins and the comment form, the admin menu item and the dashboard counter all go.

Two things to understand before you use it. Most of the code above hangs on filters. A filter is a point where WordPress asks a question, in this case “are comments open on this post?”, and lets code answer it. So the comments_open filter changes what WordPress reports, not what is stored. Your posts still hold comment_status = open in the database. That is deliberate. Deactivate the plugin and everything returns exactly as it was, which is a useful property to have. It is also why Step 2 is still worth doing, so the stored state matches reality.

The other is the dashboard widget. Removing dashboard_activity removes recent posts along with recent comments, because WordPress merged them into one widget years ago. If you want to keep the posts list, leave that block out and accept a small comments section on the dashboard.

If anything breaks, deactivate the plugin from the Plugins screen. If you cannot reach wp-admin, rename the site-no-comments folder over SFTP and WordPress will deactivate it for you on the next request.

Pingbacks, trackbacks and XML-RPC

Pingbacks and trackbacks are the old system for sites notifying each other about links. They arrive as comments, they are almost entirely spam now, and the setting in Step 1 only covers new posts. The pings_open filter above closes them everywhere.

There is a separate route in, though. XML-RPC is an older WordPress feature that lets other software post to your site without logging in through the browser, and it is still switched on by default. One of the things it accepts is a pingback, without touching the comment form at all, and it has a long history of being used for spam and for bouncing attacks off your server at somebody else’s. If nothing on your site needs XML-RPC, close that door. This goes in the same plugin file, below what is already there:

// Remove only the pingback methods, leaving the rest of XML-RPC working.
add_filter( 'xmlrpc_methods', function ( $methods ) {
    unset( $methods['pingback.ping'], $methods['pingback.extensions.getPingbacks'] );
    return $methods;
} );

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

You can go further and disable XML-RPC entirely with the xmlrpc_enabled filter, but check first. The Jetpack plugin and the official WordPress mobile apps use XML-RPC, and turning it off will break them without a clear error. Removing just the pingback methods gets most of the benefit with none of that risk.

Delete the comments or just close them?

Close them first. It is instant, reversible, and it costs nothing to leave the data in place while you decide.

Delete when the comments are genuinely all spam, when the table is large enough to be slowing down backups and exports, or when you would rather not be holding the personal data. That last one is a fair point in the UK: every approved comment stores a name, an email address and an IP address, and if you are never going to use any of it, not holding it is the cleaner position.

Keep them when there is real content in there. Genuine questions and answers under a post are useful to the next reader and they are part of the page, so wiping them can thin out content that was doing a job. Read a sample before you empty anything.

If you are deleting the underlying posts as well as their comments, think about what those URLs will return afterwards. That is a separate decision, and setting up 301 redirects properly covers when to redirect an old URL and when to let it go.

How to check it worked

Open a post, a page and an image attachment page in a private browsing window, logged out. No comment form, no “comments are closed” message, no existing comment list. Logged out matters, because some themes render things differently for administrators.

In the admin, confirm the Comments item has gone from the sidebar, and try loading /wp-admin/edit-comments.php directly. It should bounce you to the dashboard rather than showing the screen.

Then wait a fortnight and check for new comment notification emails. That is the only test that proves nothing is still slipping through a route you missed, and in my experience the route is always attachment pages.

When it does not work

Comments still show on old posts

Their stored comment_status is still open. Go back and do the bulk edit in Step 2, or use the WP-CLI command. If you added the code route first, the bulk edit dropdown will have disappeared, so deactivate the plugin, run the bulk edit, then reactivate it.

The comment form has gone but the old comments still display

Your theme renders the comment list separately from the form. The comments_array filter in the code above handles it. A few themes fetch the comments themselves rather than going through WordPress’s normal comments_template() route, which means the filter never gets asked. That is a fault in the theme, and the only ways out are to delete the comments or to have the theme’s template edited.

Spam keeps arriving after everything is closed

Two usual culprits. Attachment pages, which the admin bulk edit does not reach. Or XML-RPC pingbacks, which bypass the comment form. Both are covered above.

The Comments menu is gone but the dashboard still shows a count

The admin bar node and the dashboard widget are separate from the menu item and need removing individually. Both blocks are in the snippet.

A form or review plugin stopped working

Some plugins store their data as comments with a custom comment type, product reviews in WooCommerce being the obvious one. Blanket filters can hide them. If that happens, make the filters conditional on comment type rather than applying to everything, and test the affected feature specifically.

Common questions

Does disabling comments hurt SEO?

No. Google does not require comments and it does not reward an empty comment section. What it can cost you is the extra page content that genuine discussion adds, so if a post has real conversation under it, closing new comments while keeping the old ones is a reasonable middle ground.

Can I keep comments on the blog and off everywhere else?

Yes. Skip the blanket approach: leave the Discussion setting on, and use the bulk edit to close comments on pages only. If you want it enforced in code, make the comments_open filter check get_post_type() and return false only for the types you want closed.

Will this remove comments from WooCommerce product reviews?

It can, because reviews are stored as comments. If you sell online, keep reviews working by excluding the review comment type from the filters, and test a product page properly before you finish.

Do I still need a spam plugin?

If comments are genuinely off everywhere, no, and that is one fewer plugin and one fewer subscription. Contact form spam is a separate problem needing a separate answer, so do not remove your form protection at the same time.

Is there a single setting that does all of this?

No, and that is the honest answer nobody wants. WordPress treats the default for new posts, the stored value on each post, the theme’s template output and the admin interface as four separate things. Any solution, plugin or code, is addressing all four.

What you have now

Comments are off for anything you publish from here, closed on everything already published, gone from pages, posts and attachment pages, and no longer taking up space in the admin. Pingbacks are closed and the XML-RPC route in is shut. The spam is deleted.

If you took the code route, the whole thing lives in one small plugin you can read in a minute and deactivate in a second, which is worth more than a settings screen when you come back to it in two years. If you took the plugin route, that is a perfectly sensible call for a site somebody else maintains.

The one thing to check again in a fortnight is whether any notification emails are still arriving. If they are, it is attachment pages or XML-RPC, and both are covered above. If you would rather this sort of upkeep just happened without you thinking about it, that is the kind of thing a maintenance plan exists for.