Are you looking to disable comments on your WordPress site? Whether you want to stop spam, reduce moderation workload, or simply prefer not to have comments on your content, turning off comments in WordPress is a straightforward process. In this guide, we’ll walk you through several methods to disable comments on your WordPress site, including for specific posts, pages, or site-wide.
Why Disable Comments?
Before diving into the how-to, it’s essential to understand why you might want to disable comments:
- Reduce Spam: Comments can attract spam, which can be time-consuming to manage.
- Control Content: Keeping comments off ensures that only your voice is heard.
- Focus on Content: Without comments, your readers can focus more on the content itself.
- Improve Performance: Disabling comments can reduce the load on your server, improving site performance.
Methods to Disable Comments in WordPress
1. Disable Comments for New Posts
To disable comments for all future posts, follow these steps:
- Go to your WordPress Dashboard.
- Navigate to Settings > Discussion.
- Uncheck the option Allow people to submit comments on new posts.
- Click Save Changes.
This setting will disable comments on all new posts you publish from now on.
2. Disable Comments on Existing Posts and Pages
If you want to disable comments on existing posts and pages, you can do so individually or in bulk:
Individually:
- Edit the post or page where you want to disable comments.
- In the Discussion section, uncheck Allow Comments.
- Update the post or page.
Bulk Edit:
- Go to Posts > All Posts or Pages > All Pages.
- Select the posts or pages you want to edit.
- Choose Edit from the Bulk Actions dropdown and click Apply.
- In the bulk edit options, set Comments to Do not allow.
- Click Update.
3. Disable Comments Site-Wide Using a Plugin
For a more comprehensive solution, you can use a plugin to disable comments across your entire site:
- Go to Plugins > Add New.
- Search for the Disable Comments plugin.
- Install and activate the plugin.
- Go to Settings > Disable Comments.
- Choose whether to disable comments everywhere or only on specific post types.
- Save your settings.
4. Disable Comments Programmatically
If you prefer a code-based solution, you can add a few lines of code to your theme’s functions.php
file:
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
}
add_action('admin_init', 'df_disable_comments_post_types_support');
// Close comments on the front-end
function df_disable_comments_status() {
return false;
}
add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);
// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);
// Remove comments page in menu
function df_disable_comments_admin_menu() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'df_disable_comments_admin_menu');
// Redirect any user trying to access comments page
function df_disable_comments_admin_menu_redirect() {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
}
add_action('admin_init', 'df_disable_comments_admin_menu_redirect');
Conclusion
Disabling comments on your WordPress site can help you maintain control over your content, reduce spam, and improve site performance. Whether you choose to disable comments for new posts, existing posts, or site-wide, the methods outlined in this guide will help you achieve your goal. Select the approach that best fits your needs and enjoy a cleaner, more streamlined website experience.
By following these steps, you can effectively disable comments on your WordPress site and ensure that your content remains focused and spam-free.
How to Add TinyMCE in WordPress for Textarea
Allow SVG File Uploads in WordPress