Disable the comments on WordPress is the most reason to protect the site from spammy content which can harm our site.
It is true that the site seems incomplete without the comment section because it allows us to interact with our site visitors.
But some website owners don’t want to allow a comment section on their site and actually, some websites don’t need the comment section to display.
Because some websites build with WordPress for small businesses and these websites often don’t have a blog page. So if there is no a requirement for blog page then no need for a comment section.
So in this tutorial, you will learn how to turn off the comment section and completely disable it from the frontend so no one can comment on the site.
Let’s get started!
Disable Comments on New Articles
By default, WordPress allows a comments section, and anyone can comment on blog posts or pages. So we will use the standard dashboard settings to disable the comments on new post articles.
You have to make settings in Settings > Discussion page to disable the comment on the WordPress site. You can change these settings anytime you want.
Go to Settings > Discussion menu page from the dashboard, and then you will see many options to control the comments on WordPress.
See the option “Allow people to post comments on new articles“, it is checked by default, and you have to uncheck it and then Save the settings.
After saving the settings, you will see your new posts/pages have no comment section. The above settings will disable the comment section from WordPress posts.
But if you want to allow a comment section on a specific blog post or page then you can still do it without changing this setting. Let’s see it.
See Also: Duplicate Specific Pages OR Posts in WordPress
Disable Comments on Specific Post or Page
As per the above settings, we completely turned off the comment section for all future posts or pages. But if you want to disable comments on a specific post then let’s see how you can do it.
Go to posts or pages (Posts > All Posts) and click the Edit option for that specific post in that you want to hide the comments section.
Now you will see the Discussion panel on the right sidebar and in this panel, you have to uncheck the “Allow comments” option. See the following image.
This will disable the comments on a specific post or page in WordPress. You can also apply these settings for bulk posts or pages.
Note: If you don’t see that Discussion panel in the right sidebar then it means it is hidden. So you have to first show it by enabling the option as shown in the following image.
You can also disable the comments on a specific post or page in a programmatic way. You have to add the following line of code in your theme’s functions.php file and save it.
Note: Don’t forget to change the post ID with your post ID. You can also customize this code as you required.
Disable Comments on Posts or Pages in Bulk
Let’s say you have many posts that you want to disable the future comments for those posts and you are doing one by one to make it then stop.
There is also a way to edit the bulk posts and turned off the comments. Simply you have to select multiple posts and make your action. Let’s see how you can do it.
See Also: How to Unpublish WordPress Posts, Pages in Bulk?
Go to Posts > All posts and select the multiple posts that you want to edit. Now select the Edit option from dropdown and click on the Apply button.
Now when you click on the Apply button, it will open the popup section like the following image. Here you need to select “Do not allow” option from the Comments dropdown and then Update the settings.
Let’s see a programmatic way to disable the comments for bulk posts or pages.
Simply you have to add the following lines of code in your child theme’s functions.php file and save it.
Note: Don’t forget to change the post IDs array with your post ids. You can customize code as you want.
Disable Comments on Media Attachments
To disable the comments on media attachment files, you have to follow the same step as we showed you above. There are two ways, you can manually disable the comments on the WordPress media file or you can do this in programmatic ways.
For manually you have to do the same step as we did in the above for posts. You have to uncheck the “Allow comments” option from the Discussion panel. See the following image for reference.
This method is a little hard and time-consuming because you have to do it one by one for those media you don’t want to allow comments.
But if you know a little bit about coding and can edit the files of WordPress by following standard ways then there are easy ways to disable the comments for media attachments.
Let’s see the programmatic way to disable the comments for media posts.
Open the functions.php file, I would recommend doing the changes in a child theme if you don’t have a child theme then follow this article to create a child theme in WordPress.
Add the following code hook in your theme’s functions.php file and save it.
In the above code, we used the
comments_open filter hook to disable the comments on all attachment post types. If you want to disable for specific then you can make a condition by checking the
See Also: 16 Ways to Get WordPress Post ID
Disable Comments on WordPress with Plugin
So the above methods, we see how we can turn off the comments on WordPress posts, pages, and media files without any plugin.
Now we will use a plugin “Disable Comments – Remove Comments & Stop Spam” to disable the comment where you want.
See Also: How to Install WordPress Plugin Step by Step
Using this plugin you can disable the comments everywhere (globally on your entire website) or you can select specific post types.
In the above image, we have disabled the comments for posts, pages, and media files of the entire website. You can select the options as you want or select the Everywhere option to completely disable from website.
There are more plugins that you can use to disable the comments on your website. It is up to you. Check the list of disabling comments plugins here.
If you liked this post then please subscribe to our newsletter for more posts like this and please also share with your friends.