There are instances where disabling comments on WordPress becomes necessary, whether for reducing spam or streamlining site management.
You can use several methods to disable comments on your WordPress site. Firstly, plugins like WPCode or Disable Comments offer various customizations, allowing you to disable comments across your site or on selected post types.
Alternatively, the built-in option lets you turn off future comments site-wide or manage them on specific pages or posts, enhancing focus and content quality. Consider disabling comments manually by editing your theme’s functions.php file for more control.
Let’s explore all these methods in detail.
Table of Contents
- How to Disable Comments on WordPress Using a Code Snippets Plugin
- How to Disable WordPress Comments Using a Specialized Plugin
- How to Disable Comments in WordPress Using Built-In Options
- How to Turn Off Comments on WordPress Manually
How to Disable Comments on WordPress Using a Code Snippets Plugin
The WPCode plugin offers an efficient way to manage code snippets, including a pre-made snippet for completely disabling comments on your WordPress site without directly editing code or dealing with individual settings.
Follow these step-by-step instructions to disable comments using this feature.
- From your WordPress dashboard, navigate to Plugins > Add New Plugin and search for WPCode.
- Find the WPCode plugin in the search results, and install and activate the WordPress plugin.
- Navigate to the Code Snippets menu in your WordPress left menu. A list with pre-written code snippets will open.
- Find the Completely Disable Comments snippet. This snippet is designed to disable comments across your entire website, ensuring no new comments can be posted and hiding existing ones. If you don’t see it, navigate to Library from the left menu, use the search box to find the snippet, and add it to your active snippets list.
- You can activate the snippet immediately by toggling the Activate switch to the On position. Alternatively, you can review its settings by clicking its name.
If you’ve activated the snippet, comments will now be disabled across your entire WordPress site, including posts, pages, and custom post types.
If you need to re-enable comments at any point, simply return to the WPCode dashboard and toggle the activation switch to Off.
How to Disable WordPress Comments Using a Specialized Plugin
The Disable Comments plugin is a straightforward and effective solution for managing comment settings. It allows WordPress users to disable comments on their site, either globally or on specific post types.
Follow these steps to configure the plugin according to your needs.
- From your WordPress dashboard, navigate to Plugins > Add New Plugin and search for Disable Comments.
- Find the Disable Comments plugin in the search results, and install and activate the plugin.
- Navigate to Settings > Disable Comments.
- You will see two main options: Everywhere and On Specific Post types.
Selecting Everywhere will disable comments across your entire WordPress site, including all posts, pages, and custom post types. This option is suitable for websites that do not require comment functionality.
If you prefer to disable comments on specific post types only, choose On certain post types.
You can then select from the list of post types, such as Posts, Pages, and any custom post types your site may have.
This option provides more flexibility, allowing you to disable comments where they are unnecessary while keeping them enabled in sections of your site where discussion is encouraged.
Below the main settings, you might find additional options to remove comment-related items from various parts of your WordPress site. These could include disabling comment RSS feeds, removing the comments link from the Admin Bar, and more. Select any that apply to your needs. - Click Save Changes at the bottom of the page.
Your settings will now be applied, and comments will be disabled according to your selections.
If you decide to re-enable comments in the future, simply return to the Disable Comments settings page and adjust the configurations as needed.
Remember to save your changes to re-activate comments on your WordPress website.
How to Disable Comments in WordPress Using Built-In Options
WordPress offers several built-in options to control the commenting feature, allowing users to disable WordPress comments globally or on a per-post basis and manage comments in bulk for multiple posts or pages.
Disable Future Comments From WordPress Settings
This method stops comments on all future posts but does not affect existing comments or the ability to post comments on existing posts.
- From your WordPress dashboard, navigate to Settings > Discussion.
- Look for the section titled Default post settings and uncheck the option Allow people to submit comments on new posts.
This action disables comments for all future posts and pages created after this setting is applied. - Scroll down and click Save Changes to apply your new settings.
Remember, this change doesn’t retroactively apply to published posts or pages created before adjusting this setting.
Disable Comments on a Specific Page or Post
To disable comments on a specific post or page, which is helpful for targeted control over where users can engage in discussions:
- From your dashboard, go to Posts or Pages and click on the title of the post or page you want to edit.
- Inside the editor, look for the Discussion settings panel on the right side of the screen.
- Uncheck Allow comments. This action disables comments for that specific post or page.
- Update or publish the post/page to save your changes.
Disable Comments on Pages and Posts in Bulk
To disable comments on multiple posts or pages simultaneously, which is efficient for applying changes to existing content:
- Navigate to the Posts or Pages menu in your WordPress dashboard.
- Click on the checkbox at the top of the list to select all the posts on the current page or manually select multiple posts/pages you want to edit.
- Choose Edit from the Bulk Actions dropdown menu, then click Apply. The Bulk Edit area will appear.
- Find the Comments dropdown menu in the Bulk Edit area and select Do not allow.
- Click the Update button to apply the change. This action will disable comments for all selected posts or pages.
How to Turn Off Comments on WordPress Manually
Manually disabling comments in WordPress involves adding code to your theme’s functions.php file that programmatically disables comments on your WordPress site.
Before proceeding, we recommend using a child theme to avoid losing your changes when updating the parent theme.
Here’s how to do it:
1. Access your site’s files through FTP or the File Manager in your hosting control panel. Navigate to /wp-content/themes/your-child-theme/.
2. Locate the functions.php file and start editing it.
3. Add the following code snippet at the end of the file:
// Disable support for comments and trackbacks in post types
function 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', 'disable_comments_post_types_support');
// Close comments on the front-end
function disable_comments_status() {
return false;
}
add_filter('comments_open', 'disable_comments_status', 20, 2);
add_filter('pings_open', 'disable_comments_status', 20, 2);
// Hide existing comments
function disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter('comments_array', 'disable_comments_hide_existing_comments', 10, 2);
// Remove comments page in menu
function disable_comments_admin_menu() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'disable_comments_admin_menu');
// Redirect any user trying to access comments page
function disable_comments_admin_menu_redirect() {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url()); exit;
}
}
add_action('admin_init', 'disable_comments_admin_menu_redirect');
// Remove comments metabox from dashboard
function disable_comments_dashboard() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'disable_comments_dashboard');
4. Save your changes.
This manual method for disabling comments in WordPress provides a deeper level of control, catering to specific needs or preferences for managing site interactions.
Bottom Line
Looking to enhance your website’s performance, streamline content, or simply reduce spam comments? WordPress offers multiple pathways to disable WordPress comments, each catering to different needs and skill levels.
Use plugins like WPCode or Disable Comments for a user-friendly approach, leverage built-in settings for quick adjustments, or even dive into manual code edits for complete control. You can choose the best method for your website’s requirements.
September 10, 2024 7:31 am
The code block for the “How to Turn Off Comments on WordPress Manually” section is messed up. There are no line breaks so it’s unusable if you just want to copy the code into your theme’s function.php file.
September 10, 2024 5:43 pm
Sorry about that. It’s fixed now.