How to turn off comments wordpress

New Page

How to Completely Disable Comments in WordPress (Ultimate Guide)

Last updated September 9, 2022 By Editorial Team | Reader Disclosure Disclosure : Our content is reader approved. This means that if you click on some of our links, we may earn a commission. Find out how WPBeginner is funded, why it matters, and how you can support us.

Share Fees 511 Tweet Fees Facebook Messenger WhatsApp E-mail

Wondering how to fully or partially disable WordPress comments?

Although comments are a great way to drive visitors to your site, you might not want to allow comments on your site for a number of reasons. There are many ways to disable comments, whether it’s just on specific posts, pages, or post types, or even completely remove comments from your entire website.

In this article, we are going to show you the step by step process to disable comments in WordPress.

How to Completely Disable Comments in WordPress How to Completely Disable Comments in WordPress

Why Disable Comments in WordPress?

There are many reasons why you might want to disable comments on specific posts or pages, or disable comments on your entire website.

For example, bloggers may post certain posts, such as advertisements, on which they do not wish to allow comments. In those cases, you can easily disable comments on those specific posts or pages.

Many small business owners use WordPress to build their website. These commercial websites often don’t have a blog section and mostly have static pages like services, about us, contact, etc. In such cases, there is no need to allow comments.

Another common scenario is that some professional blogs choose to disable comments altogether to prevent spam. While you can still use spam protection techniques (which we’ll share later in this article), disabling the comments section will definitely fix the problem.

Whatever your reason, you can certainly disable comments and even remove the comments section entirely from your WordPress site.

Here is a brief overview of what you will learn in this article:

  • Disable comments completely
  • Disable comments on future articles
  • Disable comments on a specific page or post
  • Disable Comments on Pages and Bulk Posts
  • Delete all WordPress comments
  • Disable comments in the media
  • Disable WordPress Comments Sitewide Using a Plugin
  • Remove “Comments are closed” in WordPress
  • Spam protection techniques

The first methods will tell you how to disable comments on pages, posts or media without using a plugin. Later, we will tell you how to remove the comments section from your WordPress blog using a plugin.

That said, let’s look at different ways to disable comments in WordPress.

Video tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, keep reading.

Disable comments completely

Es muy fácil deshabilitar completamente los comentarios y eliminar todas las funciones relacionadas con los comentarios del panel de administración, así como de la parte frontal de su sitio web.

El complemento gratuito WPCode viene con una biblioteca de fragmentos de código preconfigurados, y puede usar el fragmento ‘Deshabilitar completamente los comentarios’ para eliminar todos los rastros de ellos de su sitio.

Simply install and activate WPCode, and then navigate to Code Snippets » Library in your WordPress admin panel. Here, you can search for ‘completely disable comments’ and hover your mouse over the result named the same thing.

You can then click on ‘Use Snippet.’

Use new snippet in wpcode Use new snippet in wpcode

WPCode will then take you to the ‘Edit Snippet’ page where the plugin has already configured everything for you.

All you need to do is toggle the switch to ‘Active’ and click ‘Update.’

The edit snippets page for WPCode The edit snippet page for WPCode

Now, WPCode will disable all comments-related features from your website.

If you prefer to remove all comments manually from your site, you can paste the following code into your theme’s functions.php file. This should only be done by advanced users, as editing your core WordPress files can easily break your site.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

add_action( ‘admin_init’ , function () {

     // Redirect any user trying to access comments page

     global $pagenow ;

     

     if ( $pagenow === ‘edit-comments.php’ ) {

         wp_safe_redirect(admin_url());

         exit ;

     }

 

     // Remove comments metabox from dashboard

     remove_meta_box( ‘dashboard_recent_comments’ , ‘dashboard’ , ‘normal’ );

 

     // Disable support for comments and trackbacks in post types

     foreach (get_post_types() as $post_type ) {

         if (post_type_supports( $post_type , ‘comments’ )) {

             remove_post_type_support( $post_type , ‘comments’ );

             remove_post_type_support( $post_type , ‘trackbacks’ );

         }

     }

});

 

// Close comments on the front-end

add_filter( ‘comments_open’ , ‘__return_false’ , 20, 2);

add_filter( ‘pings_open’ , ‘__return_false’ , 20, 2);

 

// Hide existing comments

add_filter( ‘comments_array’ , ‘__return_empty_array’ , 10, 2);

 

// Remove comments page in menu

add_action( ‘admin_menu’ , function () {

     remove_menu_page( ‘edit-comments.php’ );

});

 

// Remove comments links from admin bar

add_action( ‘init’ , function () {

     if (is_admin_bar_showing()) {

         remove_action( ‘admin_bar_menu’ , ‘wp_admin_bar_comments_menu’ , 60);

     }

});

For more information, check out your guide on how to paste code snippets into WordPress.

Deshabilitar comentarios en publicaciones futuras

If you’ve just started your WordPress site, you can easily stop comments on your future posts.

To do that, go to Settings » Discussion from the left sidebar of your WordPress admin panel.

On this page, you need to uncheck the option that says “Allow people to post comments on new articles” and then click on the Save Changes button to store your settings.

Deshabilitar comentarios en publicaciones futuras Disable comments on future posts

This will disable comments on all your future posts. However, if you want to allow or disallow comments on a specific post, then you can still do it without changing this setting.

We’ll cover that in the next section.

Deshabilitar comentarios en una página o publicación específica

By default, comments are turned off on all your pages.

However, WordPress gives you the freedom to enable or disable comments on individual pages and posts.

Simply head over to Pages » All Pages from the left sidebar. On the next page, you need to hover your mouse cursor over the title of a page that you want enable or disable comments and click the Edit link.

Opción de edición de página de WordPress WordPress Page edit option

On the top-right corner of your page, you’ll see the 3 vertical dots icon. You need to click on it to open a dropdown menu and then click on Options.

This will open a popup box, and you need to make sure the Discussion box is enabled here.

Opciones de documento de página Page document options

Once you close this modal box, you’ll see the Discussion meta box on the right side of your editor. If you don’t see it, then please make sure that you click on the Document tab to view it.

Metabox de discusión Discussion meta box

Now, you can uncheck the Allow Comments box to disable comments on this page and click on Update to save the changes.

On the other hand, if you want to selectively enable comments, then you can just check the box to enable it for certain pages.

You can follow the same process for turning off comments on individual posts or other custom post types.

Deshabilitar comentarios en páginas y publicaciones a granel

Want to disable comments on all your published posts and pages without doing it individually? You can do that without the use of a plugin.

First of all, go to Posts » All Posts to see all your articles.

Next, select all the posts, choose Edit from the Bulk Actions dropdown box, and click on Apply.

Editar publicaciones en bloque Edit Posts in bulk

You’ll now be able to perform bulk actions including changing the author name and turning off comments for all the selected posts.

Select Do not allow from the comments dropdown box and click on Update. This will disable comments on all your selected posts.

Deshabilitar comentarios en publicaciones de forma masiva Disable comments on posts in bulk

You can follow the same process to turn off comments on your pages.

Eliminar todos los comentarios de WordPress

While the above methods will disable comments on your posts and pages, it will not remove the existing comments from your WordPress site.

To delete all the comments from your site, click on Comments from the left sidebar of your admin panel.

Eliminar todos los comentarios de WordPress Delete all WordPress comments

Next, select all the comments, choose Move to Trash option from the Bulk Actions dropdown box, and click on Apply. This will delete all the existing comments from your site.

If your website has a lot of comments, then you will have to repeat this step multiple times.

Deshabilitar comentarios en páginas de medios

If you are looking to disable comments on media pages, then there are two ways to go about it.

You can manually disable comments on individual media attachment files by following the methods we discussed above, but that can be really time-consuming.

The easier way to bulk disable comments is by using a code snippet. If you’re an advanced user, you can either paste the following code into your theme’s functions.php file. We don’t recommend this method as it’s very easy to break your WordPress site by editing core files.

1

2

3

4

5

6

7

8

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 );

We recommend everyone use WPCode, the simplest and easiest way for anyone to add code to their WordPress site.

Simple install and activate the free WPCode plugin. For more information, you can see our step-by-step guide on how to install a WordPress plugin.

Upon activation, head to Code Snippets in your WordPress dashboard. Hover your mouse over ‘Add Your Custom Code (New Snippet)’ and click the ‘Use Snippet’ button.

WPCode Agregar nuevo fragmento WPCode Add new Snippet

Next, you will see the ‘Create Custom Snippet’ screen. Here you can give your snippet a title such as ‘Disable Comments on Media Pages’ and paste the code above into the ‘Code Preview’ area.

WPCode deshabilita todos los comentarios en los medios WPCode disabling all comments on media

Note that you should have ‘PHP Snippet’ selected from the drop-down menu under ‘Code Type’ and the switch toggled to ‘Active.’

Now, you can simply press the ‘Save Snippet’ button, and the code will be live on your site.

Deshabilite los comentarios de WordPress de manera fácil usando un complemento

If you don’t want to disable comments manually, then you can use the Disable Comments plugin to do it with just a click.

It allows you to completely disable comments everywhere on your WordPress site. You can also disable them on specific post types like posts, pages, media, and others. It also removes the comment form and stops displaying existing comments.

Desactivar Comentarios Disable Comments

The first thing you need to do is install and activate the Disable Comments plugin. You can follow our step-by-step guide on how to install a WordPress plugin for detailed instructions.

After activating the plugin, head over to Settings » Disable Comments from the left sidebar of your admin panel.

Selecting the ‘Everywhere’ option allows you to disable comments on your entire WordPress site. The plugin will also remove the comments menu item from your WordPress admin area.

If you select the second option of ‘On Specific Post Types’, then you can selectively disable comments on your posts, pages, or media.

Deshabilitar la configuración de comentarios Disable Comments settings

For example, if you want to remove comments only from the media attachments, then you can select On Specific Post Types radio button and then check the Media checkbox.

You can do the same if you only want to turn off comments on WordPress pages. Using the plugin is the easiest way to disable comments on WordPress pages.

When you’re done, simply click on Save Changes to complete the process.

Eliminar “Los comentarios están cerrados” en WordPress

If your WordPress theme is not checking the comment status properly, then it may still display the comment form, existing comments, or even show the “Comments are closed” message.

You can ask your theme developer to fix this because this is not a standard compliant approach.

Alternatively, you can also try fixing it yourself by following the instructions below.

First, connect to your WordPress site using FTP Client or the File Manager in your WordPress hosting control panel. Now navigate to your current theme folder which will be located in /wp-content/themes/ folder.

In your theme folder, you need to locate the file comments.php, right-click on that file, and rename it to comments_old.php.

Cambiar el nombre del archivo php de comentarios Rename comments php file

Next, you need to right-click in the right panel of your FTP client and select Create new file option. And then, name your new file as comments.php and click the OK button.

Crear un nuevo archivo de comentarios Créer un nouveau fichier de commentaires

This trick simply serves as an empty comments template to your WordPress theme, so no comments or comment-related messages will be shown.

If your WordPress theme does not have the comments.php file, then you need to ask your theme developer which file you need to edit.

Spam Protection Techniques

If you’re planning to disable WordPress comments just for the sake of protecting your site from spammers and link builders, then we would rather recommend you use some of the following techniques to combat spam.

Akismet

Akismet plugin for WordPress Akismet WordPress Plugin

Akismet is one of the best plugins to manage spam comments. And the best part is that it was created by the team behind WordPress.

This plugin checks every comment on your site and checks if it is spam or not. For more details, you can refer to our guide on the Akismet plugin.

Final comments

Did you know that you can close comments after a certain period of time?

Close comments after a specific period Close comments after a specific period

Go to Settings » Discussion and check the box “Automatically close comments on articles older than 14 days”.

This will automatically close the feedback form after 14 days. You can also change the number of days according to your needs.

Spammers typically target older messages, so many users change this setting to 180 days, which significantly reduces spam.

Honeypot with Antispam Bee

We at WPBeginner have found it useful to add a second plugin called Antispam Bee which works in conjunction with Akismet to significantly reduce comment spam on your site.

Adds an invisible honeypot that blocks 99% of spambot comments.

Comment Captcha

Although adding a captcha to your comment form is not user-friendly, it still helps protect your site from spammers.

You can use the Advanced noCaptcha and Invisible Captcha plugin to add Google reCaptcha just before the submit button on your comment form.

Remove Website URL Form Field

Another way to deal with linkers and spammers is to remove the website URL field from the comment form. Here is an example from the WPForms website:

Remove website URL field from comment form Remove website URL field from comment form

And you can use Comment Link Remove plugin and Comments Tool for this purpose. It allows you to remove the website URL field from your comment form without touching a single line of code. Isn’t that awesome?

Block bad IP addresses

You can also prevent bad IP addresses from accessing your WordPress site. This will help you block spammers and hacking attacks.

To do this, you can refer to our guide on how to block IP addresses in WordPress.

Either way, we hope this detailed guide helped you understand how to completely disable comments in WordPress with and without a plugin. You can also check out our guide on how to start your own podcast, or our expert comparison of the best email marketing services for small businesses.

If you liked this article, please subscribe to our YouTube channel for WordPress tutorial videos. You can also find us on Twitter and Facebook.

Share Fees 511 Tweet Fees Facebook Messenger WhatsApp E-mail


Video How to turn off comments wordpress

Related Posts

How to add seo keywords in wordpress

Contents1 Cómo agregar palabras clave de SEO en WordPress (aumentar el CTR y las clasificaciones)1.1 Post Title1.2 Headline1.3 Header Tags1.4 Introduction and Conclusion1.5 Body Copy1.6 URL1.7 Meta…

How to embed google calendar into wordpress

Contents1 How to Add a Google Calendar in WordPress (Step by Step)2 Add a Google calendar to your website3 calendario de Google3.1 Versatile plans and pricing4 Video…

How to change the logo in wordpress

Contents1 How to Add a Custom Logo to Your Site Header2 Site Logo2.1 Planes y precios versátiles3 Add, remove or edit a custom logo4 Video How to…

How to add a popup on wordpress

Contents1 Easily create a WordPress emergent form (2 forms)1.1 ¿Por qué usar un formulario emergente de WordPress?1.2 Método #1: Crear un formulario emergente con OptinMonster + WPForms1.3…

How to roll back wordpress version

Contents1 How to Revert WordPress: Undo WordPress Updates (Easy Way)2 How to Downgrade WordPress & Roll Back to a Previous Version2.1 1. A WordPress update included significant changes…

How to rollback wordpress version

Contents1 How to Downgrade WordPress and Revert to an Older Version1.1 1. A WordPress update included significant changes that are not compatible with your theme or plugins1.2…