How to Disable Comments in WordPress - DigiHold

How to Disable Comments in WordPress (2026)

Share on

Table of Contents

You can disable comments across your entire WordPress site in under two minutes by going to Settings, then Discussion, and unchecking “Allow people to post comments on new articles.” That single toggle stops new comments from appearing on every future post and page you publish.

But that checkbox only handles new content. If your site already has dozens or hundreds of posts with open comment forms, those stay active until you close them one by one, or use the bulk method covered below. And if you’ve been running WordPress for more than a few months, there’s a good chance your wp_comments database table has collected thousands of spam entries you’ll want to clean out too.

This guide covers every method to shut down comments completely, from the built-in settings to code snippets and plugins. It also explains why turning off comments matters for your site’s security and performance, and what to do after you’ve flipped the switch so your database doesn’t keep hauling around dead weight.

Whether you’re running a business site, a portfolio, or an online store selling digital products, you probably don’t need open comment forms on every page. The methods below work on any WordPress installation, from a single blog to a multisite network, and you can pick whichever approach fits your comfort level with code.

Why Should You Turn Off WordPress Comments?

wordpress disable comments

The most obvious reason is spam. Even with Akismet or a CAPTCHA plugin running, automated bots hammer wp-comments-post.php constantly. On a typical WordPress site that’s been live for a year, you’ll find anywhere from a few hundred to tens of thousands of pending spam comments sitting in your database, each one taking up rows in the wp_comments and wp_commentmeta tables.

But spam isn’t just annoying. It’s a real security surface. The wp-comments-post.php endpoint accepts POST requests from anyone by default, and attackers routinely use it to test for cross-site scripting vulnerabilities, inject phishing links, or probe your server’s response behavior. If you want a deeper look at how these attacks work and how to protect against them, the guide to securing your WordPress site covers the full picture. A comment form is an open door that you’re leaving unlocked on every single page, and unless you’re running a blog where reader discussion genuinely adds value, there’s no good reason to keep it open.

The performance angle matters too. Every comment stored in your database adds to the size of wp_comments and wp_commentmeta. On sites with years of accumulated spam, those tables can reach hundreds of megabytes. That bloat slows down database queries across your entire site, not just on the pages with comments. If your site already feels sluggish, these eight speed optimization techniques address the broader performance picture. Backup files get larger, migrations take longer, and your hosting resources get wasted on data that nobody will ever read.

There’s also the moderation time. If you’re a solo site owner or a small team, reviewing pending comments, filtering false positives from your spam filter, and deleting trackbacks eats into time you could spend creating content or improving your product pages. For business sites, portfolio sites, and product-focused WordPress installations, comments rarely contribute anything meaningful to the visitor experience.

And then there’s the legal angle that many site owners overlook. If your site collects personal data through comment forms, including names, email addresses, and IP addresses, you may have obligations under GDPR, CCPA, or similar privacy regulations. If you need to handle cookie consent and privacy compliance on your WordPress site, a tool like DigiConsent can manage that for you. Disabling comments entirely removes one more data collection point you’d otherwise need to document in your privacy policy and handle in response to data access requests.

How Do You Disable Comments on All New Posts?

disable comments on new WordPress posts

WordPress includes a global switch that controls whether new posts and pages accept comments by default. Open your WordPress admin dashboard, go to Settings, then click Discussion. At the top of the page, you’ll see a checkbox labeled “Allow people to post comments on new articles.” Uncheck it, scroll down, and click Save Changes.

Once you save that setting, every post and page you create from this point forward will have comments turned off automatically. You won’t see a comment form on the front end, and visitors won’t be able to submit anything. This is the fastest way to stop new comments from showing up, and it works without any plugin or code change.

There are two things this setting doesn’t do, though. First, it doesn’t close comments on posts and pages that already exist. Any content you published before changing this setting still has its own comment status, and if that status was “open,” comments will keep flowing in. Second, it doesn’t disable comments on media attachments, which have their own discussion settings that WordPress enables separately. Both of those gaps need their own fix, which is what the next two sections cover.

While you’re on the Discussion settings page, you might also want to uncheck “Allow link notifications from other blogs (pingbacks and trackbacks).” Pingbacks are a legacy feature that most modern WordPress sites don’t need, and they’re frequently abused by spammers to generate fake inbound links. Turning off both comments and pingbacks in one pass saves you from having to come back later.

How Do You Close Comments on Existing Posts and Pages?

bulk close comments on existing posts

If your site has more than a handful of published posts, closing comments one by one through the post editor would take forever. WordPress has a built-in bulk action tool that lets you change the comment status on dozens of posts at once, and it works on both posts and pages.

Go to Posts, then All Posts in your admin sidebar. Click the checkbox at the top of the list to select every post on the current page. If you have more than 20 posts, you’ll need to increase the “Screen Options” count (click the tab in the upper-right corner and set it to a higher number, like 100 or 200). Once you’ve selected all the posts you want, open the Bulk Actions dropdown at the top, choose Edit, and click Apply.

A bulk edit panel will appear with several fields. Find the Comments dropdown and change it from “No Change” to “Do not allow.” Click Update, and every selected post will have its comment status set to closed. Repeat this process for Pages and for any custom post types your site uses. The whole operation takes a few minutes even on a site with hundreds of pieces of content.

For sites with thousands of posts, the bulk editor can feel slow because it processes each update individually. In that case, a direct database query is faster. If you’re comfortable with phpMyAdmin or WP-CLI, running UPDATE wp_posts SET comment_status = ‘closed’, ping_status = ‘closed’ will close comments and pingbacks on every post in one shot. Just make sure to back up your database before running any direct SQL, and flush your object cache afterward so WordPress picks up the changes.

Don’t forget about media attachments. WordPress creates a post entry for every image and file you upload, and those attachment posts can have their own comment status. The same SQL query covers them because media attachments are stored as post_type “attachment” in wp_posts, but if you’re using the bulk editor in the admin, you’ll need to go to Media, switch to list view, and repeat the bulk close process there.

How Do You Remove Comment Support Entirely With Code?

remove WordPress comment support with code

The settings and bulk methods close the comment forms, but WordPress still loads the comment infrastructure behind the scenes. The Comments menu item stays in your admin sidebar, comment-related meta boxes appear in the post editor, and your theme might still include template tags that check for comment status on every page load. If you want a cleaner result, a small snippet in your theme’s functions.php file (or a site-specific plugin) can strip all of that out.

Here’s the approach. Add a function hooked to the admin_init action that removes the comment meta box from every registered post type. Use remove_meta_box to target the “commentsdiv” and “commentstatusdiv” boxes. Then hook into admin_menu and call remove_menu_page(‘edit-comments.php’) to get rid of the Comments item in the admin sidebar entirely. You can also redirect any direct visits to the comments admin page back to the dashboard, so no one accidentally lands there.

On the front end, add a filter on comments_open and pings_open that returns false regardless of the post’s individual setting. This acts as a hard override, which means even if a post somehow has its comment status set to “open” in the database, WordPress won’t render the comment form or accept submissions. Combine this with a wp_enqueue_scripts hook that calls wp_dequeue_script(‘comment-reply’) to stop WordPress from loading the comment reply JavaScript on every page.

The code method is the most thorough option because it removes comments from the admin experience completely. Your editors won’t see comment-related options when creating content, there’s no menu item cluttering the sidebar, and no unnecessary scripts load on the front end. It’s especially useful on sites where multiple people have admin or editor access, because it removes the possibility of someone accidentally re-enabling comments on a single post.

One important note about where to put this code. If you add it directly to your theme’s functions.php, you’ll lose it when you update or switch themes. A better option is to create a small must-use plugin by placing a PHP file in wp-content/mu-plugins/. Must-use plugins load automatically on every page and can’t be deactivated through the admin, which makes them perfect for site-wide behavior changes like this. They also survive theme changes, so you won’t accidentally re-enable comments the next time you refresh your site’s design.

Which Plugins Can Disable WordPress Comments for You?

Disable Comments plugin for WordPress

If you’d rather not touch code, the Disable Comments plugin by developer Samir Shah handles most of what the code snippet above does, and it’s free. It’s the most popular dedicated solution for this, with well over a million active installations on the WordPress plugin directory. Install it through Plugins, then Add New in your dashboard, search for “Disable Comments,” and activate it.

Once activated, go to Settings, then Disable Comments. You can choose to disable comments everywhere (the simplest option) or only on specific post types like posts, pages, or media. The “Everywhere” setting removes the comment form from the front end, hides the Comments admin menu, removes comment-related widgets, and closes the wp-comments-post.php endpoint so bots can’t even attempt to submit. It effectively does everything the manual code approach does, with a settings page instead of a functions.php edit.

One thing the Disable Comments plugin doesn’t do is delete your existing comments. It hides them and prevents new ones, but the data stays in your database. If your goal is a full cleanup, including reclaiming the database space those old comments occupy, you’ll need to handle that step separately. The next section covers how.

There are other plugins that include comment disabling as part of a broader feature set. If your site currently uses comments as a makeshift contact channel, switching to a dedicated contact form plugin gives you better control over submissions, email notifications, and spam filtering, all without the security risks of leaving comments open to the public. You keep the communication channel while removing the attack surface.

Before you install any plugin for this, consider what you already have. If you’re running a security plugin that includes a firewall, check whether it already blocks or rate-limits requests to wp-comments-post.php. You can find a comparison of the best WordPress security plugins to see which ones cover this. Some security setups handle the bot traffic side without needing a separate comment-disabling plugin. Combining fewer plugins that each do one job well keeps your site lighter than stacking overlapping tools on top of each other.

What Should You Do After Turning Off Comments?

Disabling comments stops new ones from arriving, but it doesn’t clean up what’s already there. If your site has been live for a while, your wp_comments table probably holds hundreds or thousands of entries that are doing nothing except taking up space. Go to Comments in your admin dashboard (if you haven’t removed it via code or plugin), select all, and move them to Trash. Then empty the Trash to actually remove them from the database.

For sites with a large number of comments, the admin interface might time out before it finishes. In that case, use WP-CLI or phpMyAdmin. The command wp comment delete $(wp comment list –format=ids) –force deletes every comment in one pass. Or run TRUNCATE TABLE wp_comments; TRUNCATE TABLE wp_commentmeta; directly in MySQL if you want to wipe both tables completely and reclaim the disk space. Back up first, always.

Once the comments are gone, run an OPTIMIZE TABLE command on wp_comments and wp_commentmeta in phpMyAdmin to reclaim the freed disk space. MySQL doesn’t automatically shrink table files after a TRUNCATE or mass DELETE, so this step ensures your database actually gets smaller, not just emptier. On shared hosting where disk and memory quotas are tight, this can make a noticeable difference in overall site performance.

After cleaning out comments, consider what you’re replacing them with. A contact form on your main pages gives visitors a clear path to reach you without the public visibility that makes comments attractive to spammers. Social media links let people engage with your content on platforms where you already moderate discussions. For WordPress sites that sell digital products, a support ticket system or a community forum with proper authentication is far more effective than open comment threads that attract noise instead of real questions.

Frequently Asked Questions

Does disabling comments in WordPress affect SEO?

No. Google doesn’t use user-generated comments as a ranking signal, and most comment sections are filled with spam that can actually hurt your site’s perceived quality. Removing comments cleans up your pages and can improve load times, which does help SEO.

Can you disable WordPress comments without a plugin?

Yes. You can turn off comments for new posts through Settings then Discussion, close existing comments with the bulk editor, and add a small functions.php snippet to remove comment support from the admin entirely. No plugin required.

How do you delete all existing WordPress comments at once?

Use WP-CLI with the command wp comment delete $(wp comment list –format=ids) –force to delete every comment. For a complete wipe, run TRUNCATE TABLE wp_comments and TRUNCATE TABLE wp_commentmeta in phpMyAdmin. Always back up your database first.

Will disabling comments break my WordPress theme?

Most modern themes handle missing comments gracefully and simply won’t render the comment section. If your theme uses comments.php or comment-related template tags, those functions return empty results when comments are disabled instead of throwing errors.

Should you disable comments on a WordPress blog?

It depends on your audience. If you get genuine reader engagement that adds value to your posts, keep comments open. But if your comments are mostly spam, promotional links, or empty replies, disabling them saves moderation time and improves security without losing anything meaningful.

Do you need to disable comments on WordPress media attachments too?

Yes. WordPress creates a database entry for every uploaded file, and each attachment can have its own comment status. Most site owners forget about media comments because they’re hidden from the normal post list. Use the same bulk edit process on the Media library, or apply the SQL or code method which covers all post types including attachments automatically.

Maria Lecocq

I’m Maria, operations wizard at DigiHold. Passionate about community building and making tech accessible. I love sharing insights on digital strategy and connecting people with powerful tools!

Subscribe to our Newsletter

Stay updated with our latest news and offers

0 Comments on "How to Disable Comments in WordPress (2026)"

Leave a Reply

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