The comment section of WordPress is a great way to add interaction with your visitors. But what if you don’t want comments on every section of the site. Perhaps you want to disable comments for media attachments in WordPress.
After all, not everything needs to have a comment box.
In this tutorial, I’ll show you a couple of ways you can remove the comment box in WordPress regarding attachments and various post types.
Now, you can easily set WordPress to deny comments in the “General” settings area. However, this prevents users from commenting on anything. Perhaps you just want WordPress to disable comments on images.
Why Enable Comments in the First Place?
The comment section is great for connecting with your audience. It boosts your reputation among readers and makes the website appear more interactive.
In essence, it improves retention rates, return visits and has potential to turn casual visitors into sales and leads.
In fact, you can install a variety of tools to engage readers through the comment section.
Now, I know a few of you might be worried about spam filling the comment section. Luckily, WordPress has a myriad of ways to prevent spam from getting out of hand.
Using Disable Comments
Today, I’ll show you a bit of what the “Disable Comments” plugin can do for you. It’s an easy plugin that gives you the option to turn off comments in WordPress according to section.
It’s perhaps one of the most popular disable comments plugin for WordPress. With over one million active installs and an excellent review score, it appears many treasure this tool.
However, depending on how you have media attachments set up on your website, it might not be exactly what you’re looking for. If this is the case, I’ll also include a code snippet later on that you might find useful instead.
Install and activate the “Disable Comments” plugin. You’ll see a couple of plugins with a similar name. Use the one by, “Samir Shah.”
Go to settings and click, “Disable Comments.”
You’ll have two options available from this disable comments plugin in WordPress. You can turn off all comments by clicking “Everywhere,” or you can choose which post types by clicking the box.
Click the “Save Changes” button.
Adding a Code Snippet
Although this plugin works exceptionally well, perhaps you want to add a snippet of code instead.
For this, you’ll need to insert coding into the site’s functions.php file or a site-specific plugin you have installed. For this tutorial, I’m simply going to add it to the functions.php file.
NOTE: It’s probably a good idea to use a child theme when making adjustments like this. You don’t want to add the code to disable comments on media attachments in WordPress only to have an update erase it.
Edit the functions.php file of your website. You can do this a number of ways such as an FTP program like FileZilla, cPanel’s File Manager or other methods that let you access the site’s root directory.
Add this code to the file:
In this example, I am using cPanel’s File Manager.
You can find the file by going to the “/wp-content/themes/” section of your site. Open the folder of the theme your using and edit the functions.php file.
Once you save the file, WordPress will disable comments on media attachments throughout the website.
Not Everything Needs a Comment Section
You don’t need a comment section on every portion of the website. Sometimes content is capable of standing on its own whether it’s a video or image.
It doesn’t take much effort to disable comments on images and other attachments in WordPress. It all really depends on how you have files saved and what you’re displaying to visitors.
How often do visitors leave comments on your site? Do you think being interactive in the comment section increases the return-visitor rate of your content?
Author: Michael Brockbank
Michael has been in the tech industry in some form or another since the late 1990s. He’s built a variety of websites using HTML, Joomla and WordPress. Starting his freelance writing career in 2012, he’s completed thousands of projects world-wide covering a wide scope of topics. Michael is currently the Content Marketing Team Lead. Today, he manages a team of writers to create tutorials, blog posts and support content for customers. Outside of GreenGeeks, he manages a YouTube channel that helps others learn how to become freelance writers, bloggers and overall professionals.