How to Disable Comments in WordPress (And Why You Might Want To)
The WordPress comments system can be a valuable feature. Letting visitors leave comments on your posts can increase engagement and provide various other benefits. At the same time, this isn’t functionality you’ll need or want on every website.
Fortunately, if you aren’t using them, it is possible to disable WordPress comments. Aside from removing an unneeded feature, this can be a smart way to reduce spam and speed up your WordPress website.
In this post, we’ll talk more about why you might want to disable comments in WordPress. Then, we’ll walk you through three quick and easy ways to do so.
Migrate today for free
Let’s get started!
a fairly robust comments feature:
Example of a comment on a WordPress site
WordPress enables you to let visitors leave comments on your site’s content. By default, this feature is disabled for pages and enabled for posts. This makes sense, as it’s rare you’d want to permit comments on static web pages.
On the other hand, comments sections can really enhance your blog posts, news articles, and other timely content.
Still, not every website needs or will benefit from comments sections. In fact, sometimes it’s best to disable WordPress comments altogether. Some of the situations in which this makes sense include:
When you don’t have a blog, or you use the ‘posts’ content type to create a different type of content (such as product pages).
Your site is largely devoted to providing information via static pages, rather than generating conversations.
You’re running a business website and you’re concerned that comments may make your pages appear less professional.
You’d like to encourage your audience to communicate somewhere other than on your posts and pages, such as in a dedicated forum.
No matter what type of site you run, there are a few other potential benefits to turning off comments in WordPress.
For example, you won’t have to worry about spam comments making your site look messy, or filling up your posts with spammy links. In addition, disabling comments means your pages will be leaner, which can have a positive effect on your site’s performance.
Every site is different, so you’ll need to weigh up the pros and cons of comments for your particular niche and audience. If you decide you’d like to disable comments, either partly or entirely, there are a number of easy ways to make it happen.
How to Disable Comments in WordPress (3 Methods)
There are quite a few ways to disable comments in WordPress. The three main options are to use WordPress’ built-in settings, a plugin, and some custom code.
Each approach has its advantages and is more useful in specific scenarios. You can read through all three or use the links below to jump to the section you’re most interested in. Disable Comments:
The Disable Comments WordPress plugin
This plugin enables administrators to globally disable comments, or disable them for specific post types only. Disable Comments has over 1 million active installs and a 4.9 out of 5-star rating, so it comes well recommended. Plus, it’s easy to use.
After installing the plugin, you’ll find its new options under Settings > Disable Comments:
Disable Comments plugin settings
As you can see, your options are pretty straightforward. You can disable comments everywhere on your site with one click.
Alternately, you can turn them off for posts, pages, or custom post types. This lets you disable WordPress comments on pictures and other media files, as well as on WooCommerce products.
Finally, just hit the Save Changes button. Keep in mind that these settings can’t be overridden by enabling comments via the regular WordPress Discussion settings or on individual posts and pages.
This a useful solution if you have multiple users on your site and want to prevent anyone else from re-enabling the comments feature.
Option 2: Pick Up a Premium Solution
Of course, the above plugin isn’t your only option for dealing with your WordPress site’s comments sections. You can also consider purchasing a premium plugin. One solution is to pick up the perfmatters plugin, which is developed by a team member here at Kinsta:
The perfmatters WordPress plugin
This plugin is designed to improve your WordPress site’s performance and offers a suite of features such as a streamlined dashboard and various behind-the-scenes tweaks that minimize potential slowdowns and bloat.
In addition, perfmatters includes a very simple option for turning off comments in WordPress. You’ll find it in the plugin’s settings under the Options tab (the setting is labeled Disable Comments). By toggling this option, you can enable or disable comments globally, without the need to worry about any additional settings.
This does offer less fine-grained control over your comments settings than the previous plugin. However, if you simply want to turn off your WordPress comments, and you’re also looking to speed up your website, this tool can handle both tasks for you effortlessly.
3. Disable Comments via Custom Code
If neither of the above options offers enough control, or you want more options but would like to avoid adding another plugin to your site, you can use custom code instead.
What you can accomplish via this method will naturally depend on your technical skill and experience, but simply disabling your site’s comments section is pretty simple.
You can remove the comments section from appearing within your WordPress theme altogether using some basic HTML commands. Please note that editing the source code of your WordPress theme is risky, and could break your site if not done correctly.
On top of that, best practices suggest creating a child theme when performing such activities. If you aren’t comfortable doing this yourself, you may want to source the work out to a WordPress developer.
If you’re interested in trying this technique yourself, make sure to first test it on a staging environment and always back up your production website before pushing changes live.
Now, open your page.php file in your favorite HTML editor, look for the following line of code:
<?php comments_template( '', true ); ?>
Go ahead and replace it with this line of code instead:
<!-- Begin Comment <?php comments_template( '', true ); ?> End Comment -->
This will turn off the comments section on all of your site’s pages, both removing existing comments and preventing new ones.
To do the same with your site’s posts, navigate to your single.php file and find the following code:
<?php comments_template(); ?>
Then, replace it with this code:
<!-- Begin Comment <?php comments_template(); ?> End Comment -->
With that, you’ll have disabled WordPress comments on both your posts and pages.
Keep in mind that you’ll need to repeat this process for additional post types if needed.
Sometimes, you’ll want to encourage your website’s visitors to ask questions and start discussions with one another. However, if you want to prevent spammy content or would like to improve performance, you might want to disable WordPress comments instead.
There are three main ways to do this. You can disable comments on WordPress using:
WordPress’ built-in options.
A WordPress plugin, such as Disable Comments or perfmatters.
Now, it’s your turn: are you keeping comments enabled on your site? Yes, no? Share your experience in the comments section!
The post How to Disable Comments in WordPress (And Why You Might Want To) appeared first on Kinsta Managed WordPress Hosting.