How To Turn Off Comments In WordPress

Photo of author
Written By Charlie Giles

Devoted WordPress fan behind CodeCraftWP. Sharing years of web expertise to empower your WordPress journey!

Disclosure: This post may contain affiliate links, which means if you click on a link and make a purchase, I may earn a commission at no additional cost to you.

Discover how to turn off comments on your WordPress site effectively using dashboard settings, plugins, theme files, and custom functions. Find the right method for you.

Disable Comments Globally

Navigate Dashboard Settings

When you want to disable comments globally on your WordPress site, it’s like turning off a light switch in your entire house. Instead of going into each post or page one by one, you can make this change from the comfort of your dashboard settings. Here’s how:

How Do I Access My Dashboard?

First things first, if you haven’t already done so, log in to your WordPress dashboard using your username and password. Once inside, navigate through the left-hand menu until you find the Settings section—think of it as the main control panel for your site.

Where Are the Comments Settings Located?

Within the settings panel, look for an option called Discussion. This is like finding the specific drawer in your kitchen where you keep all your baking supplies. Click on it to access a series of settings that govern how comments behave on your site.

Disabling Comments Globally

Inside the Discussion settings, there should be a checkbox labeled “Allow comments”. Think of this as flipping a switch: when unchecked, no new comments will appear on any posts or pages on your site. This is perfect if you’ve decided to move away from traditional comment sections and are using other methods for feedback.

By following these simple steps, you can streamline the management of your WordPress site by removing unnecessary clutter from your content. Imagine having a clean, uncluttered space in your home—your blog posts will now be just that!


Deactivate Comments Using Plugins

Install Comment_disable Plugin

So, you want to take a break from comments on your WordPress site but aren’t sure how? Well, one of the easiest ways is by using plugins. The Comment_disable plugin is like a digital off-switch for your comments section. It’s user-friendly and can be installed with just a few clicks.

Configure Plugin Options

Once you’ve got the Comment_disable plugin up and running, it’s time to tweak its settings. Navigate through the WordPress dashboard and find the Plugins section. There, locate Comment_disable, activate it if it isn’t already, and click on Settings. Here, you can decide whether to disable comments globally or selectively for specific posts or pages.

You’ll notice a couple of options that allow you to customize your comment-free experience. For instance, you might want to add a notice to visitors explaining why comments are turned off. This could be as simple as a small message or even an engaging call-to-action encouraging users to share their thoughts on social media instead.

By taking these steps, you ensure that your site operates more smoothly without the potential noise and spam that can come with open comment sections. It’s like setting up a quiet space in your home where people are welcome but not required—making it easier for everyone to enjoy your content without interruptions.


Modify Theme Files Directly

Locate wp-comments.php File

If you’re comfortable diving into your theme’s files directly, this method is a great way to disable comments. First, you need to locate the wp-comments.php file within your WordPress installation directory. This file contains all the necessary functions and code for rendering comments on your site.

Imagine you’re looking for a specific ingredient in a recipe; just as you wouldn’t miss a spoonful of that flavor, finding this file is crucial because it’s where the comment magic happens. To access this file, navigate to wp-includes folder within your theme directory.

Edit comments_template() Function

Once you’ve located the wp-comments.php file, open it in your preferred code editor and search for the function comments_template(). This function is responsible for loading the comment template into your post or page. By editing this function, you can effectively disable comments on all posts.

Think of the comments_template() function as a key that unlocks the door to comments. If you change its behavior, it’s like locking the door from the inside—no one will be able to come in! You can add conditional statements or use PHP code to completely remove this template or replace it with an empty function.

Here’s a simple example of what you might do:

PHP

// Find and replace this line:
comments_template();
// With this line instead:

By making these changes, you ensure that comments are disabled on your site. This approach is powerful because it directly manipulates the core functionality of WordPress, but keep in mind that if you update your theme or WordPress, you may need to revisit these changes.

Remember, modifying core files can be risky, so always create a backup before making any edits. It’s like taking a deep breath before jumping into cold water—being prepared helps ensure you’re not caught off guard!


Use WordPress Functions

When you want to disable comments globally without getting your hands too dirty by modifying theme files or installing plugins, using a function is like wielding a precise tool that cuts directly to the heart of the matter. But where do you start? Well, let’s dive into one of the most straightforward methods: adding an add_filter to the functions.php file.

Add_filter to functions.php

Imagine your website as a vast garden, and comments are like weeds that grow uncontrollably. You can use add_filter in the functions.php file to mow down those pesky weeds without damaging any of the beautiful flowers (posts). The add_filter function allows you to modify or extend the functionality of WordPress by adding filters to certain actions.

To implement this, you’ll need to open your functions.php file. This is like opening a door into the heart of your website’s codebase, where you can customize its behavior to fit your needs perfectly. Once inside, add the following code snippet:

PHP

function disable_comments() {
return false;
}
add_filter('pre_comment_on_post', 'disable_comments');

This bit of code tells WordPress not to allow comments on any post by default, much like setting a garden hose to continuously water the ground instead of the plants. The pre_comment_on_post filter is like a checkpoint where we decide if comments should be allowed or not; our function returns false, meaning “nope, keep those comments away!”

Define disable_comments Function

Now that you’ve set up your function, it’s essential to understand what exactly this disable_comments() does. Think of it as a key piece in a puzzle that, when placed correctly, disables the ability for users to post or interact with comments on any page or post.

The disable_comments function is defined within our functions.php file and contains only one line: return false;. This simple command tells WordPress to return false whenever it checks if comments should be enabled. It’s like a light switch that turns off the ability for anyone to leave a comment, ensuring your content remains untouched by external influences.

By adding these lines of code, you effectively disable all comments on your site in a clean and efficient way. This method is particularly useful when you need a quick solution or want to avoid potential conflicts with other plugins or themes that might interfere if you were to use alternative methods.

Leave a Comment