How to Disable WordPress Comments?

Comments can be found on any website. Hundreds of comments get published underneath posts, product pages, videos and etc. on the internet. By default, WordPress offers this feature to its users.

In WordPress users can publish their comments on posts, pages, WooCommerce products and etc. and by default, there are no limitations to them. But a WordPress website may want to disable their comment section or apply restrictions to it.

In this article, we will explain and teach you how to disable WordPress comments.

Why Disable WordPress Comments?

Comments help you build a connection with your audience also it improves your SEO. But in some cases, comments can damage your website.

Imagine a small business website with only a few pages (about us, contact us and introduction). Obviously, a small website needs to disable its comment section to make the website look more appealing.

On the other hand, big business websites may not be able to control the incoming comments and the number of comments could potentially decrease the website’s performance and create issues for the database. In this case, you need to disable your comment section as well.

How to Disable WordPress Comments?

To disable WordPress comments first, you need head over to your WordPress Dashboard > settings > discussion and enable “Automatically close comments on articles older than … days”. By default, the number of days is set to 14, you need to replace that with 0 days.

Once the settings updated the comment section will be closed.

Disable Comments for a Specific Page or Post

There are two ways to disable comments for a specific page or a post. One way is by quick edit and the other way is through customization.

In a first way, from your WordPress Dashboard click on posts and hover your mouse on the post you wish to disable comments for. You can see “quick edit” click on it. Then make sure “Allow Comments” is unticked then click update.

In a second way, again you need to click on posts and hover your mouse over the specific post and click on “edit”. On the right-hand side menu, you can see the “discussion” tab, click on it and make sure “Allow comments” is unchecked.

Keep in mind, in the second method if you don’t see the “discussion” tab on the right-hand side, from the top right corner click on the arrow key to open the menu and then untick “Allow comments”.

Bulk Disable Comments for Pages and Posts

If you wish to disable comments for multiple pages and posts you need to head over to your WordPress Dashboard > Posts, then select multiple pages or posts and change “bulk actions” to “edit” and click on “Apply” next to it. Then from the comments section select “do not allow” and click on update.

Disable WordPress Comments for New Posts

To disable comments for your future posts, head over to your WordPress Dashboard > Settings and discussion.

Make sure you untick “Allow people to post comments on new articles” and then click on save settings.

Disable Anonymous Comments

By default, WordPress won’t accept anonymous comments. But to make sure it is disabled or if you have enabled it by accident, to disable it you need to head over to your WordPress Dashboard > Settings > Discussion and make sure “Comment author must fill out name and e-mail” is ticked.

Enable WordPress Comment Moderator

By default, WordPress automatically accepts and publishes comments or each visitor can only publish one comment.

Now any new comments need to be approved before they are published on your website.

Disable WordPress Comments After a Few Days

We have explained this method above. We have entered 0 days in “Automatically close comments on articles older than … days” which would disable comments section immediately.

Now if your business plan is to keep the comment section open for 7 days to receive comments. You need to replace 0 days to 7 (or any number you desire). Once a week is gone your comment section will be automatically disabled.

If your comment section is open and it automatically accepts any comments and you want to restrict people or bots from publishing links or advertising on your website, you need to follow the steps below.

From your settings click on discussion and scroll down until you see “Comment moderation” the first option is “Hold a comment in the queue if it contains … or more links.” By default, this option is set 2 links.

However, you can select any number you desire with this feature you can hold more comments in a queue or accepts more links in your comment section.

Manage Comments and Spams With Blacklist

Another feature designed in WordPress is the ability to manage your comment blacklist.

From settings click on discussion and scroll down until you see “Comment Blacklist’. You can see two big boxes. Each of them performs a certain task. In the first box, you can type in words that you want to block.

For example, if you block the word “free” if anyone uses “free” in their comment it automatically gets blocked.

The second box is similar to the first box. The second box is blacklist if, for example, you type in “free” any comment that contains the word “free” is considered as spam.

Remove URL Field From Comments

The URL field in the comment section attracts a lot of spammers to post comments on your website and by doing so build a backlink.

You can simply remove the URL from comments when approving them. However, the simpler method is by completely removing the URL field from the comment section.

We recommend using the popular Code Snippets plugin. First, install it then activate it. Now you have to create a new snippet and paste the following code into the code box:

function remove_website_field($fields) {
   return $fields;
add_filter('comment_form_default_fields', 'remove_website_field');

After adding the snippet above, the URL field will be removed from the comment section.

Disable Comments From Media

By default, you cannot disable comments for your media files and the only way to disable them is by manually editing your codes.

There are two main ways to edit your codes. First, you can add a piece of code to your function.php file from your theme editor and the other way is by installing Code Snippet plugin.

The first way, you need to copy and paste the code below to your function.php file:

disable wordpress comments
function filter_media_comment_status( $open, $post_id ) {
    $post = get_post( $post_id );
    if( $post->post_type == 'attachment' ) {
        return false;
    return $open;
add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );

But in a second way, you need to download Code Snippet plugin from WordPress official plugin store and then install and activate it. After installation, you could see “Snippets” in your WordPress Dashboard menu. You can create a new snippet and paste the code above and click on save.

Disable HTML From Comments

To disable HTML from comments you need to add a piece of code to your function.php file or use Code Snippet plugin and create a new snippet to disable HTML from your comment section.

disable wordpress comments

Copy and paste the code below to your function.php file or Code Snippet:

    // This will occur when the comment is posted
    function plc_comment_post( $incoming_comment ) {
    // convert everything in a comment to display literally
    $incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
    // the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
    $incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
    return( $incoming_comment );
    // This will occur before a comment is displayed
    function plc_comment_display( $comment_to_display ) {
    // Put the single quotes back in
    $comment_to_display = str_replace( ''', "'", $comment_to_display );
    return $comment_to_display;

Disable Trackbacks for New Posts in WordPress

If you have noticed when you publish a post from other websites a trackback is automatically published along with the post.

disable wordpress comments

If you wish to disable this feature, head over to your WordPress Dashboard > settings and click on the discussion. You need to disable/untick “Allow link notifications from other blogs (pingbacks and trackbacks) on new articles”.

Delete All WordPress Comments

When you have disabled WordPress comments, no new comments can be published. However, old comments still remain on your website.

disable wordpress comments

You need to manually delete your old comments. First head over to your comments page. Then select all of your comments and from the bulk option on top select “move to trash” and click apply to delete them.

Keep in mind, if you have more than one page of comments you need to do the same for all of your pages.

Disable WordPress Comments Using a Plugin

If you prefer to use plugins over manually changing your WordPress settings, or if what we discussed above is confusing for you, you can use a plugin.

disable wordpress comments

To disable WordPress comments you can use Disable Comments plugin. This plugin is very user-friendly and easy to use. You can even disable or enable comments for a specific page or post.

For example, if you are using different post types gallery, video or standard you can disable their comment section by using Disable Comments plugin.

Remove “Comments are closed” From WordPress

When you disable WordPress comments, usually “comments are closed” message will be displayed and users cannot publish new comments. This message is unpleasant for websites with the disabled comment section.

To solve this issue you can ask your website developer to do the necessary changes. If you don’t know any website developers or you don’t want to hire anyone, you can follow the steps below:

First, head over to your cPanel and File Manager or use an FTP client and head over to your public_html folder.

Now head over to wp-content and go to themes. Enter the theme you have activated.

Once you have found your website’s theme, you need to locate the comments.php file and rename it to comments_old.php. Now your comment section is completely gone. But you need to replace the file with another file to prevent any issues.

Right-click on the page and select “Create new file” or from the menu on top select “Create new file” and create a new comments.php file.

Now you won’t see any messages in your comment section.

How to Block Spam Comment?

Spam comment is a nightmare for any website owner. Because it fills up your database and a lot of nonsense comments are published on your website which would have a negative effect on your SEO and database. But how to block spam comments?

We have discussed this matter in another article. However, we try to mention a few pointers here. There are a few ways to block spam comments. For example, you can disable WordPress comments so no one can post any comments.

This method is useful for websites that don’t need their comment section. But what about websites that depend on their comment section?

Restricting the comment section is another way to deal with spam comments. Manually approving comments, limiting links, using blacklist or review list and only allowing your users to post comments are ways to deal with spam comments.

You can also use a popular plugin called Akismet to block spam comments. Keep in mind, business websites must purchase this plugin and need to pay $5 a month.

Alongside Akismet, you can also use the Antispam Bee plugin to prevent spam comments.

Lastly, there is another way to block spammer bots from posting a comment on your website. You can use Google reCAPTCHA technology to block bots from posting a comment on your website.

Simply you need to install and activate Advanced invisible CAPTCHA or noCAPTCHA plugin. Once you receive your API keys you can enable them and use this technology on your website to block spam comments.

The post How to Disable WordPress Comments? appeared first on BetterStudio.

Go to source

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.