How to Disable Comments and Pings in WordPress (Site-Wide, Attachments, Admin, and Code)
Table of Contents
- Introduction
- What You’re Turning Off (Comments vs Pings)
- Before You Start (Quick Safety Checks)
- Turn Off Comments and Pings for New Content (Site-Wide Defaults)
- What These Settings Do Not Change
- Mini Checklist Before Moving to Next Step
- Disable Comments on Existing Posts and Media Attachments
- Disable Comments on Media Attachments and Attachment Pages
- Remove Comment Areas From WordPress Admin (Dashboard + Menus)
- Verify Everything Is Disabled (Checklist + Common Surprises)
- Disable Comments and Pings in WordPress Programmatically (Code Method)
- Conclusion
- FAQs
Introduction
Spam and noise can make WordPress comments hard to manage. Many site owners also want fewer links from ping features. This guide shows safe ways to disable comments in WordPress.
Short answer: Use Discussion settings for new content, then bulk edit. If you need full control, add a small code snippet. You will also learn how to stop pings across your site.
You can disable comments for posts, pages, and attachment areas. You can also remove comment tools from the admin screens. The steps in this guide are safe and easy to follow. You can reverse most changes if you need comments later.
What You’re Turning Off (Comments vs Pings)
Comments are messages visitors leave under posts and pages. Pings include pingbacks and trackbacks that notify other sites. They often attract spam when your content links out. When you disable pingbacks and trackbacks WordPress stops accepting them.
Disabling does not delete comments already stored in your database. Those can stay visible unless you change display behavior. On busy sites, disabling reduces moderation time and spam risk. It also keeps internal pages cleaner for visitors and staff.
Disabling can apply to new content, or to existing items. Some themes also show comment areas on attachment pages. That is why we cover posts, media, admin, and code.
Before You Start (Quick Safety Checks)
Start with a quick backup, even for small setting changes. Use a staging site if your host provides one. Next, check whether your theme forces comments in templates. Also note any plugins that add reviews or comment boxes. After updates, clear cache so you see the real result. If you manage clients, tell editors what will change.
Before you change anything, confirm these simple goals:
- Do you want to stop new comments, or hide all UI?
- Do you need comments on products, but not on pages?
- Do you want to keep old comments visible, or remove them?
Once you decide, the next steps will be faster.
Turn Off Comments and Pings for New Content (Site-Wide Defaults)
If you want fewer tasks, start with default settings first. This method helps you disable comments WordPress site wide for new posts. It also helps you stop pings before they create spam. These settings are built into WordPress and are safe. They do not need extra tools or any coding.
Step 1: Open the Discussion Settings in WordPress
Go to your WordPress admin area and follow this path. You can do this in one minute on most sites.
- Go to Settings in the left menu.
- Click Discussion.
- Scroll to the section called Default post settings.
These options control what happens for new posts and pages. They also affect some custom content types on many sites.
Step 2: Disable Comments for New Posts and Pages
To stop new comments, you must turn off the comment option here. This is the easiest way to disable comments in WordPress by default.
In Default post settings, uncheck this option:
- Allow people to submit comments on new posts
After you uncheck it, WordPress will stop enabling comments by default. New posts will not show the comment form on most themes. New pages will also follow this setting in many setups. This is a core step for anyone wanting less moderation work.
Step 3: Disable Pingbacks and Trackbacks for New Content
Pings are not the same as comments, but they feel similar. They create entries that look like comments on many themes. They also bring spam and fake link notices. Use this option to stop pings on new content.
In Default post settings, uncheck this option:
- Attempt to notify any blogs linked to from the post
Then find this option and uncheck it too:
- Allow link notifications from other blogs (pingbacks and trackbacks)
This is the key place to disable pingbacks and trackbacks WordPress uses. Once disabled, new posts will not accept pingbacks. New posts will also stop sending trackback style notices.
Step 4: Save Changes and Confirm the Defaults
Now scroll to the bottom of the Discussion page and click:
- Save Changes
After saving, test the result with a quick check. Create a draft post and open the editor settings. Look for the “Discussion” panel if your editor shows it. On many sites, it will now show comments are off by default. You can also preview the draft to confirm no comment form appears.
What These Settings Do Not Change
This part is important, especially for older websites. These settings mainly control future content. They often do not update older posts automatically. If you need to disable older comments too, that comes next. That is where bulk actions help.
Here is what to expect after this step:
- New posts usually have comments turned off automatically.
- New posts usually have pings turned off automatically.
- Older posts may still allow comments and pings.
- Some themes may still show comment areas in templates.
Mini Checklist Before Moving to Next Step
Use this small checklist to avoid confusion later. It will also help you follow the next steps faster.
- Check one new draft post for the comment form.
- Check one new draft post for ping settings in “Discussion.”
- Clear any cache plugin, server cache, or CDN cache.
- Note any custom post types that still show comment options.
This completes the base setup for defaults. You have now started to disable comments WordPress site wide for new content.
Disable Comments on Existing Posts and Media Attachments
Now you must fix older content too. This is where many sites still show comment forms. You can handle this without editing each post manually. You can also handle attachment pages that still allow discussion.
Close Comments on Existing Posts and Pages in Bulk
Older posts may still accept comments after setting changes. You need a bulk update for the whole library. This is the easiest way to disable comments on all posts WordPress sites already have.
Step 1: Bulk Disable Comments for Existing Posts
Go to your WordPress dashboard and open your post list. Then use the bulk edit tool to close comments on many posts.
- Go to Posts → All Posts.
- Use the Screen Options to show more items per page.
- Select all posts using the top checkbox.
- Choose Bulk actions → Edit.
- Click Apply.
Now you will see the bulk edit panel. Look for the discussion controls. On many sites you will see “Comments” as an option. Set it to Do not allow and update.
- Set Comments to Do not allow.
- Click Update to save changes.
Repeat this for every page of posts if needed. This method is fast and safe for large sites.
Step 2: Bulk Disable Comments for Existing Pages
Pages can also show comment forms on some themes. If your pages should stay clean, repeat the same process.
- Go to Pages → All Pages.
- Select all pages using the top checkbox.
- Choose Bulk actions → Edit.
- Click Apply.
- Set Comments to Do not allow.
- Click Update.
This is the best approach if you want disable comments WordPress without plugin. You only use core WordPress tools and settings.
Step 3: Disable Pingbacks on Existing Posts Too
Some older posts may still accept pingbacks and trackbacks. These can appear like comment entries on your pages. Use bulk edit again to stop them.
In the bulk edit panel, look for the ping setting. Some sites show it as “Pings” or “Trackbacks.” Set it to Do not allow when available. This helps you disable pingbacks on existing posts WordPress already published.
If you do not see the option, do not worry. Many setups hide it by default.
Disable Comments on Media Attachments and Attachment Pages
Media files can create attachment pages in WordPress. Some themes link images to these pages by default. These pages may show a title, image, and comment area. That is why many users need to disable comments on media attachments WordPress sites store.
Why Attachment Pages Still Show Comments
Attachment pages behave like a content type in WordPress. They can have their own discussion settings. A theme may also include a comments template on attachment layouts. This is common on older themes and blog-focused designs.
If you want a clean experience, you should also disable comments on attachment pages WordPress generates for images and files.
Step 1: Check If Your Site Uses Attachment Pages
First, confirm if attachment pages are active on your site. Open an older post and click an image if it links anywhere. If it opens a new page with the image, you are on an attachment page.
You can also check from the Media Library:
- Go to Media → Library.
- Click an image and choose Edit more details.
- Look for an attachment URL and open it.
If that page shows a comment form or comment count, you should disable discussion there.
Step 2: Disable Comments on Individual Attachments When Needed
WordPress does not always offer a perfect bulk tool for attachments. Many sites need a simple workflow for important images first. Start with attachments that get traffic or show in search results.
Use this method for key attachment items:
- Go to Media → Library.
- Click an image and open Edit more details.
- Find the Discussion panel if visible.
- Uncheck Allow comments.
- Update or save if your screen shows a save option.
If you do not see “Discussion,” the editor may hide it. Click Screen Options at the top and enable “Discussion” if available.
Step 3: Prevent Future Attachment Comment Issues
Attachment pages can keep causing problems if themes link to them. While we will covers code-level control, you can reduce issues now.
Do these quick checks:
- Set image links to None in the block editor.
- Avoid linking images to “Media File” or “Attachment Page.”
- Use a lightbox plugin only if you truly need it.
This reduces visits to attachment pages and lowers comment exposure.
Remove Comment Areas From WordPress Admin (Dashboard + Menus)
Even after disabling comments, the admin can still show comment tools. You may still see the Comments menu and dashboard widgets. Cleaning these makes the backend look more focused. This also helps when you want to remove comments from WordPress dashboard screens.
Step 1: Hide the Comments Menu for Non-Admin Users
If your site has multiple users, restrict comment access first. Use role settings or plugin-based role control if you already use one. If you do not use role tools, you can still hide items visually. Hiding is not the same as disabling, but it helps.
Here are simple admin steps you can do now:
- Go to Users → All Users and review roles.
- Keep only trusted users as Administrator.
- Assign editors to Editor or Author roles.
This reduces who can change Discussion settings and comment status.
Step 2: Remove “Recent Comments” Widget From the Dashboard
WordPress adds a “Recent Comments” widget by default on many sites. Even if comments are off, it can still show old items. Remove it to keep the dashboard clean.
- Go to Dashboard → Home.
- Click Screen Options at the top right.
- Uncheck Recent Comments.
- Uncheck other comment-related widgets if you see them.
If your dashboard has extra widgets from plugins, check those too. Some security and cache plugins show comment-related notices.
Step 3: Remove Comment Columns From Post and Page Lists
In the Posts and Pages lists, WordPress may show comment bubbles. These bubbles can confuse users if comments are disabled. You can hide them using Screen Options.
- Go to Posts → All Posts.
- Click Screen Options at the top.
- Uncheck Comments if it is listed there.
- Repeat on Pages → All Pages.
This makes your content lists look cleaner and easier to scan.
Step 4: Remove Comment Discussion Panels in the Editor
Some editors may still see “Discussion” settings in the editor sidebar. That is where users can re-enable comments per post. Hide the panel to reduce mistakes.
- Open any post in the editor.
- Click the three-dot menu in the top right.
- Open Preferences or Panels.
- Disable Discussion if it is available.
This does not block comments by itself, but it reduces risk.
Verify Everything Is Disabled (Checklist + Common Surprises)
Now you must confirm that everything is truly off. Some themes and plugins can still show comment areas. Cache can also show old pages for a while. Verification takes five minutes and prevents surprises later.
Quick Verification Checklist
Test these items in an incognito browser window. This avoids cached admin sessions and stored scripts.
- Open an old post and confirm no comment form shows.
- Open an old page and confirm comments are closed.
- Open a media attachment page and check comment visibility.
- Check that pings are not showing as comment entries.
- Confirm the Comments menu is hidden for your team.
If your goal is full control, you may still need code changes. This is normal on advanced sites with custom themes.
Common Surprise 1: Theme Still Prints the Comment Template
Some themes always load the comment template file. Even if comments are closed, the area may show “Comments are closed.” If you want zero comment blocks, you need a stronger method. Common Surprise 2: Cache Shows the Old Comment Form
Caching can keep old HTML for hours or days. Clear your cache at every layer after updates.
Clear these layers if you use them:
- Page cache plugin cache
- Hosting server cache
- CDN cache like Cloudflare
- Browser cache for testing devices
After clearing, open the page again in incognito mode. This helps you confirm the real output.
Common Surprise 3: A Plugin Re-Enables Comments or Adds Reviews
Some plugins add comment-like features on posts or products. Review plugins can also reuse comment systems. If you see a form again, disable that feature inside the plugin.
Common Surprise 4: Custom Post Types Still Have Comments Enabled
Some sites use portfolios, projects, or landing pages as custom types. They may still support comments by default. This is where code control is best.
Disable Comments and Pings in WordPress Programmatically (Code Method)
Sometimes settings and bulk edits are not enough. Themes, plugins, and custom post types can still show comment areas. In that case, you should disable comments in WordPress programmatically. This method also helps you control pings across everything.
Where to Add the Code Safely
Use one of these safe options for long-term control.
- Add it to a small site plugin you can keep forever.
- Or add it to a child theme functions.php file.
A site plugin is safer during theme changes. It also supports clean rollbacks later.
Code Snippet: Force Disable Comments and Pings Everywhere
Create a file at: wp-content/plugins/disable-comments-pings/disable-comments-pings.php
Then activate it from Plugins → Installed Plugins.
<?php
/**
* Plugin Name: Disable Comments & Pings (Site-Wide)
* Description: Disables comments, pingbacks, and trackbacks across WordPress.
* Version: 1.0.0
*/
if (!defined(‘ABSPATH’)) exit;
/**
* 1) Close comments and pings everywhere.
*/
add_filter(‘comments_open’, ‘__return_false’, 20, 2);
add_filter(‘pings_open’, ‘__return_false’, 20, 2);
add_filter(‘comments_array’, ‘__return_empty_array’, 20, 2);
/**
* 2) Remove comment support from all post types.
* This is where remove_post_type_support comments WordPress matters.
*/
add_action(‘init’, function () {
$post_types = get_post_types([], ‘names’);
foreach ($post_types as $type) {
remove_post_type_support($type, ‘comments’);
remove_post_type_support($type, ‘trackbacks’);
}
}, 100);
/**
* 3) Hide Comments UI in admin menus, admin bar, and dashboard.
*/
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’);
}, 999);
add_action(‘wp_dashboard_setup’, function () {
remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’);
});
/**
* 4) Block direct access to comment management pages.
*/
add_action(‘admin_init’, function () {
global $pagenow;
if ($pagenow === ‘edit-comments.php’ || $pagenow === ‘comment.php’) {
wp_safe_redirect(admin_url());
exit;
}
});
/**
* 5) Stop pingback headers and ping processing.
*/
add_filter(‘xmlrpc_methods’, function ($methods) {
unset($methods[‘pingback.ping’], $methods[‘pingback.extensions.getPingbacks’]);
return $methods;
});
add_filter(‘wp_headers’, function ($headers) {
if (isset($headers[‘X-Pingback’])) unset($headers[‘X-Pingback’]);
return $headers;
});
add_action(‘pre_ping’, function (&$links) {
$links = [];
});
This approach is ideal when you want disable comments WordPress without plugin features. You control everything with one clean snippet. It also helps reduce spam from ping systems.
Rollback Tips (If You Need Comments Again)
Rollback is simple if you used a site plugin.
- Deactivate the plugin from the Plugins screen.
- Clear cache and recheck your posts and pages.
- Re-enable Discussion options if you need them again.
Conclusion
Disabling comments and pings can clean your whole WordPress site. Start with settings for new content, then bulk close older items. If your theme still shows comment areas, use the code method. It locks comments and pings across all post types. If you want help with theme conflicts or custom post types, WooHelpDesk can handle it. Visit WooHelpDesk to get fast WordPress fixes and support.
FAQ
1) Will this delete my existing comments?
No, it only closes new comments and hides forms. Your old comments stay in the database. You can delete them separately if needed.
2) Can I keep comments on posts but disable pages?
Yes, use bulk edit only on pages. Leave post discussion settings enabled for posts. Code can also target only selected post types.
3) Why do I still see “Comments are closed” on pages?
Your theme may still load the comment template block. The message can show even when comments are disabled. Remove the template call or use stricter theme edits.
4) Will this stop pingbacks and trackbacks on old posts?
Yes, the code forces pings closed on all content. It also removes trackback support from post types. This is stronger than settings alone.
5) Does this work for custom post types too?
Yes, the snippet loops through all registered post types. It removes comments and trackbacks support for each. That includes many plugin-created post types.
6) Can this help remove comment tools from the admin area?
Yes, it hides menus, the admin bar icon, and widgets. It also blocks direct access to comment admin pages. This keeps your backend clean and focused.

