Disable Comments in WordPress

If you’re tired of spam, or just find that comments are not appropriate for your site, you may want to disable this WordPress feature entirely.

If you are trying to find a way to remove the “leave a reply” text on your content, disabling comments is also the way to go. If you only want to modify the “leave a reply” text, see this tutorial instead.

Disabling comments for a brand new site is easy enough, but if you have an existing site with published content and comments, you will need to take a few extra steps.

How to Disable Comments in WordPress Manually

  1. Go to Settings → Discussion
  2. Uncheck these boxes, then save the settings:

Allow link notifications from other blogs (pingbacks and trackbacks) on new posts
Allow people to submit comments on new posts

This will automatically close the comments on any new content you publish, but it doesn’t affect your existing content.

To turn off comments on your existing posts:

  1. Go to Posts → All Posts
  2. Click the checkbox next to Title, so that all posts are selected
  3. In the dropdown where it says Bulk Actions, select Edit, then click Apply
  4. In both the Comments and Pings dropdown, select Do not Allow, then click Update

If you have a lot of posts, you will have to do this on each page of the All Posts screen.

Or, you can increase the number of posts displayed on the screen by adjusting the screen options (found at the top right of the page):

This is a viable method if you don’t have too many posts.

But it will be a burden if you have hundreds or thousands of posts. In that case you should use one of the methods below.

What happens after closing comments?

Using the method mentioned above:

  • On posts that had never received comments, all traces of comments will be removed.
  • Any comments that already existed on posts will still be displayed, but no new ones can be added.
  • There will be text that says “Comments are closed”.

If you also want to remove the “comments are closed” text, and you don’t want existing comments to show up either, the simplest way is to delete all the comments on your WordPress site.

But if you want to retain the comments and just not display them, or if you have a huge number of posts on your site, use the following method.

Disable Comments and Remove “Leave a Comment” in WordPress with a Plugin

The best plugin for this job is the Disable Comments plugin. It gives you the ability to:

  • Turn off comments everywhere
  • Turn off comments for specific post types
  • In either case, comments will not be deleted but prior comments will no longer be displayed, and there will be no “leave a reply” or “comments are closed” text.
  • Disable comments from the REST API and XML-RPC

It also has a set of options so that you can delete the prior comments as well, and it’s multisite-friendly.

Disable Comments in WordPress Without a Plugin

The simplest solution is, as described above, to turn off comments and delete any pre-existing comments. But if you want to:

  • keep existing comments but not display them on the front end
  • hide all front end references to comments
  • not use a plugin to do this

You will have to keep in mind and deal with the various ways that references to comments and commenting show up on the front end of your WordPress site:

  • The number of comments on a post with a link to reply is often displayed in the meta info
  • The comment form which is where you actually input your name and comment
  • The comments themselves, if there are any

Most other articles on this topic will tell you to either use CSS to hide the content, modify the comments.php file, or provide snippets to modify various parts of the display. But none of these provide the easiest nor the most thorough solution. For example, if you modify comments.php to prevent the comment form being loaded, this won’t address comment information being shown in the post meta.

In the end, it can be done quite simply with a couple of lines of code.

You need to use the following code in either the functions.php of your child theme, a code snippets plugin, or custom functionality plugin.

Note, this is relevant for non block-based themes. If you are using a block-based or full site editing theme, see the next section.

add_filter('comments_open', '__return_false', 20, 2); add_filter('pings_open', '__return_false', 20, 2);
Code language: JavaScript (javascript)

This closes the comments (and pingbacks) (thanks to Matt Clements) But if comments already exist for a post, they will still be displayed. To deal with that, add the following:

add_filter('get_comments_number', '0', 20, 2);

This artificially sets the comment count to 0, which will prevent comment information being displayed.

And that should do the trick!

Remove “comments are closed” and “leave a reply” text on Block-based / full site editing themes

If you are using one of the next-generation of WordPress themes, called Block-based or Full Site Editing themes (like Twenty Twenty-Two) your life will be much easier:

  1. Go to Appearance → Editor
  2. We’re looking for the single post template, so click on the drop down at the top which says Home and click Browse all templates
  3. Locate and click on the Single Post template.
  4. You will then be in the editing screen for that template, which looks very similar to typical gutenberg edit screen for posts. Locate the Post Comments block and delete it.
  5. Repeat this for any other template on your site for which you need to remove the display of comments.

Disabling comments and the related text on your WordPress site seems easy but, as we’ve seen, has some “gotchas”. Hopefully this guide provides a method that works for you.

Weekly WordPress Tips To Your Inbox

  • This field is for validation purposes and should be left unchanged.