Comments can significantly shape the experience and interaction on your WordPress site. They offer a platform for engagement, allowing visitors to voice their opinions and interact with your content.
However, while enriching, this feature can also present challenges ranging from spam to high maintenance efforts. Deciding whether to enable or disable comments can influence your site’s functionality and user experience.
This tutorial will show you how to disable comments in WordPress, delete existing comments, and prevent new comments from appearing on old content.
FAQ
How do I turn comments off in WordPress?
How do I turn off comments and pings in WordPress?
Can I turn off comments on my page?
How do I disable HTML comments in WordPress?
add_filter('pre_comment_content', 'wp_strip_all_tags');
This code removes all HTML tags from comments. Alternatively, certain security plugins can manage HTML usage in comments.
Reasons to disable comments in WordPress
Even if you want to keep comments on in some form or fashion, learning how to disable comments in WordPress will help you decide what’s best for your site. Depending on your site’s needs and purpose, there are various cases where adapting the default WordPress comments functionality better serves site visitors.
They don’t suit the brand or the website’s purpose
For some websites, especially those in professional services, ecommerce, or portfolios, comments may not align with the brand’s image or the website’s purpose. Removing this feature can maintain a cleaner, more focused site presentation.
Combating spam and self-promotion
Unfortunately, comment sections can become targets for spam and self-promotion. Disabling comments helps prevent these nuisances, ensuring that your site remains reputable and your resources are not wasted on moderation.
Decreasing moderation efforts where comments aren’t needed
Managing comments may become an unnecessary overhead if your content doesn’t seek direct feedback or user interaction. Disabling comments can free up resources and streamline site management in such cases.
Enhancing site performance and load times
Comments can slow down your page loading times, particularly on popular posts with numerous comments. Disabling them can improve overall site performance and enhance user experience, especially for content-heavy sites.
Keep comments on social media
For large volumes of comments, keeping discussions on social media platforms can sometimes be more beneficial. It enables engagement in a more dynamic environment where your audience is already active and where tools for moderation and interaction are more robust.
Using a plugin to display comments
Opting to use a specialized plugin for managing comments can provide better control over settings and appearances, enhancing the way interactions are handled on your site.
How to disable comments in WordPress
Whether you want to disable comments on a single page or post or turn them off entirely, WordPress’s default comment features allow you to adapt the comment settings to suit your needs. Here’s how to disable comments in WordPress so that you can keep this feature only where it’s needed or get rid of comments everywhere.
Disable comments on a single page or post
To turn off comments for a single page or post:
- Open the post or page in the WordPress editor.
- Under the Document settings panel, locate the Discussion box.
- Uncheck the Allow comments option.
- Save or update the post to apply the changes.
Disabling comments for all posts and pages in the WordPress dashboard
Alternatively, you can disable the comments site-wide in the WordPress dashboard. Keep in mind that disabling comments in the dashboard won’t disable comments on existing pages and posts. To stop new comments on existing content, you must delete the old comments and turn off comments on existing pages and posts.
Disabling comments on future posts
- Navigate to the WordPress dashboard.
- Go to Settings > Discussion.
- Uncheck the option Allow people to submit comments on new posts.
- Click Save Changes to ensure that future posts won’t have comments enabled by default.
Disable comments on existing posts
- Use the bulk editor to disable comments on multiple posts or pages.
- Go to Posts and select All Posts.
- Use the Bulk Actions dropdown to edit multiple posts at once.
- Choose Edit and apply.
- Set the Comments option to Do not allow.
- Click Update to make the changes effective across selected posts.
Delete comments in bulk
With comments turned off in WordPress on existing and new posts and pages, it’s time to clean up old comments. Before you delete existing comments, you might want to export them and archive the data.
- Navigate to the Comments section in the dashboard.
- Select the comments you wish to delete using checkboxes.
- Choose Move to Trash from the Bulk Actions dropdown menu.
- Click Apply to clean up unwanted comments in bulk.
Skip and automate manual work with 10Web Managed WordPress Hosting. Optimize your WordPress website effortlessly. Simplify WordPress with 10Web
Handling comments on media files
Frustratingly, WordPress allows comments by default on media files. That means every item in the Media Library has a page where users can potentially post comments.
Here’s how to disable comments in WordPress media files:
- Go to Media in your dashboard.
- Click on an item and select Edit more details.
- Find the Discussion box similar to posts and pages and uncheck Allow comments.
If you don’t see the Discussion box, it may be hidden. To enable it, go to the Screen Options menu at the top right corner of the screen. - Click Update to save the new settings.
Unfortunately, there’s no way to edit the Allow comments option in bulk. However, you can add a bit of code to your theme’s functions.php file to disable comments on media attachments.
Using an FTP client like FileZilla or your hosting provider’s File Manager, navigate to your site’s wp-content/themes/theme-folder and locate the functions.php file. Using a text editor, add the following code snippet to your functions.php file using a text editor, then save the file.
$post = get_post($post_id); if ($post->post_type == 'attachment') { return false; } return $open; } add_filter('comments_open', 'disable_comments_on_media_attachments', 10, 2);
Plugins and tools for managing comments
Plugins like Disable Comments are highly effective for managing comments across a WordPress site comprehensively. This plugin allows you to systematically disable comments in WordPress on every post, page, or media file and provides options to remove related fields from the backend.
Here’s how you can install and use the plugin to disable comments across your site:
- In your WordPress dashboard, find the Plugins menu on the left-hand side and click on Add New. This will take you to the WordPress plugin repository.
- In the Add New Plugin page, use the search box to find “Disable Comments.”
- You’ll see the Disable Comments plugin listed in the search results. Click on the Install Now button next to the plugin. WordPress will download and install the plugin.
- After the installation is complete, click the Activate button. This will activate the Disable Comments plugin on your site.
Once activated, navigate to Settings in your WordPress dashboard and click on Disable Comments.
Step 1: Select the disable option
You will see several options for disabling comments. You can choose to disable comments on specific post types or everywhere.
The settings include:
Everywhere: This will disable comments across your entire WordPress site.
On certain post types: You can select specific post types (like posts, pages, media) where comments should be disabled.
Step 2: Disable comments on media
If you specifically want to disable comments on media files, ensure you check the box next to Media. This will apply the settings to all attachment pages.
Step 3: Save changes
After selecting your preferred options, click the Save Changes button at the bottom of the page to apply your settings.
At this point, new comments are disabled, but any posts or pages that have existing comments will still display them. If you want to remove any existing comments from your site, the Disable Comments plugin lets you delete comments in bulk. This option can be found under the same settings page and is useful for cleaning up unwanted comments after disabling.
How to remove the ‘Comments are closed’ message
After disabling comments, you may find a “Comments are closed” message in their place.
To remove this message, you’ll need to edit your theme files:
- Access your theme’s comments.php file using an FTP client or your hosting provider’s File Manager.
- Look for the phrase Comments are closed within the PHP code.
- Either remove or comment out this line of code to stop displaying the message.
- Save and upload your changes.
Summing up
Comments can enhance interaction but also pose challenges such as maintenance and performance issues. Weighing their benefits against their drawbacks in the context of your specific site needs is crucial. Understanding these factors will help you optimize your WordPress site for better performance and user engagement, whether you choose to disable comments or manage them through plugins.