Table of Contents
There are a number of reasons why you might want to disable comments in your WordPress site. Maybe you don’t want to deal with the hassle of moderating comments, or perhaps you’re running a one-person show and don’t want to be inundated with notifications every time someone leaves a comment.
Whatever the reason, disabling comments in WordPress is a relatively simple process that can be accomplished in just a few steps. In this article, we’ll go over the various methods for disabling comments in WordPress and provide step-by-step instructions for each method.
How to Disable Comments in WordPress Globally
The easiest way to disable comments in WordPress is to do it globally, which means that comments will be disabled on all posts and pages on your site. To disable comments globally, follow these steps:
- Log in to your WordPress dashboard.
- Go to Settings > Discussion.
- Under the “Default article settings” section, uncheck the box next to “Allow people to post comments on new articles.”
- Scroll down and click the “Save Changes” button.
That’s it! Now comments will be disabled on all new posts and pages on your site. If you want to disable comments on existing posts and pages, you’ll need to follow the instructions in the next section.
How to Disable Comments on Individual Posts and Pages
If you only want to disable comments on certain posts and pages, you can do so by editing the individual post or page. Here’s how:
- Log in to your WordPress dashboard.
- Go to the post or page you want to edit.
- Scroll down to the “Discussion” section.
- Uncheck the box next to “Allow comments.”
- Update or publish the post or page.
Now comments will be disabled on that specific post or page. If you want to disable comments on multiple posts or pages at once, you can do so by using the Bulk Edit feature.
How to Disable Comments Using the Bulk Edit Feature
The Bulk Edit feature in WordPress allows you to make changes to multiple posts or pages at once. To use it to disable comments, follow these steps:
- Log in to your WordPress dashboard.
- Go to Posts or Pages, depending on which type of content you want to edit.
- Check the boxes next to the posts or pages you want to edit.
- From the “Bulk Actions” dropdown menu, select “Edit.”
- Click the “Apply” button.
- In the “Comments” section, select “Do not allow” from the dropdown menu.
- Click the “Update” button.
Now comments will be disabled on all of the selected posts or pages.
How to Disable Comments Using a Plugin
If you don’t want to mess with the code or settings in your WordPress site, you can use a plugin to disable comments. There are several plugins available that can do this, but one of the most popular is the Disable Comments plugin. To use it, follow these steps:
- Log in to your WordPress dashboard.
- Go to Plugins > Add New.
- In the search bar, type “Disable Comments” and press Enter.
- Click the “Install Now” button for the Disable Comments plugin.
- Click the “Activate” button.
Using the Disable Comments plugin is easy and straightforward. After installation and activation, the plugin will automatically disable comments on all posts, pages, and custom post types. If you want to re-enable comments on specific post types or individual posts or pages, you can do so by going to the plugin’s settings page.
To access the settings page, go to Settings > Disable Comments. From here, you can choose which post types to enable or disable comments on, as well as override the settings for individual posts or pages.
If you don’t want to use the Disable Comments plugin, there are other options available as well. Some other popular plugins for disabling comments in WordPress include:
- No Page Comment Plugin: This plugin allows you to disable comments on individual pages or all pages on your site.
- Disable Comments Plugin: This plugin allows you to disable comments on individual posts or pages, as well as globally on your site.
No matter which plugin you choose, be sure to read the reviews and instructions carefully to ensure that it meets your needs and is compatible with your WordPress site.
How to Disable Comments in the WordPress Code
If you’re comfortable working with code and don’t want to use a plugin, you can disable comments in WordPress by modifying your theme’s functions.php file. To do this, follow these steps:
- Log in to your WordPress dashboard.
- Go to Appearance > Editor.
- On the right-hand side, select the functions.php file from the list of theme files.
- Scroll to the bottom of the file and add the following code:
// Disable comments on all 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');
- Click the “Update File” button to save your changes.
This code will disable comments on all post types, close comments on the front-end of your site, hide existing comments, remove the comments page from the WordPress menu, and redirect any users trying to access the comments page.
It’s important to note that modifying the functions.php file can have unintended consequences if you’re not careful. Be sure to create a backup of your site before making any changes, and consider hiring a professional if you’re not comfortable working with code.
How to Disable Comments Using a Theme
Some WordPress themes come with built-in options for disabling comments on specific post types or individual posts or pages. The specific steps for doing so will vary depending on the theme you’re using, but here are some general guidelines:
- Log in to your WordPress dashboard.
- Go to Appearance > Themes.
- Click on the theme you’re using to access its options page.
- Look for a section related to comments, such as “Discussion” or “Post Settings.”
- Follow the instructions provided by the theme to disable comments on specific post types or individual posts or pages.
Keep in mind that not all themes will have this feature, so you may need to use one of the other methods outlined in this article if you can’t find an option to disable comments through your theme.
Conclusion
In this article, we’ve gone over five different methods for disabling comments in WordPress. Whether you want to disable comments globally, on individual posts or pages, or by using a plugin or code, there’s a method that will work for you.
Remember to consider your specific needs and comfort level when choosing the best method for disabling comments on your WordPress site. And as always, be sure to create a backup of your site before making any major changes.