Guide Area

Four ways to disable WordPress comments

There is many articles out there that offer step-by-step tutorials on how to disable WordPress comments. Even though disabling comments via WordPress Discussion settings works pretty well, it could happen sometimes that your theme will ignore this administration setting and display the comments anyway. In this case, you will have to edit the theme code yourself, or add custom CSS code block to your site. I will go through all of the possible settings, including the one that I found helpful on this site.

Disable WordPress comments via administration

This is the easiest way to disable WordPress comments. You do that by visiting Administration -> Settings -> Discussion and deselecting Allow people to post comments on new articles option shown below.

Wordpress Comments Settings

This setting only affects articles that you will post from now on. If you want to disable comments on articles which you already have posted in the past, you can do it by setting the value of   to 0.

Wordpress Comments Settings

Although this setting is proven to work, in my case it did not. That is the reason I wrote another methods. You should always try this method first before trying any of the listed below.

Disable Comments plugin

There is a WordPress plugin called Disable Comments which replaces any comment-related template with an empty one globally (on the entire website).  Even though it works as it is supposed to, I found myself having a problem with implementation of Fancy Facebook Comments (FFC), while having Disable Comments (DC) plugin activated too. The reason for having both of them is that my theme did not allow me to disable default WordPress comments and I did not have time to dig deep into it back then. The DC plugin removed all types of comments, including FFC comments.

This is probably not going to be an issue with your site, so you should go ahead and install the plugin. If you do have the same problem, DC’s description says that you should try to play with advanced configuration.

Wordpress Comments Settings

Otherwise, you can go to plugin settings and activate your desired option.

Wordpress Comments Settings

Here are the links for both Disable Comments and Fancy Facebook Comments plugins:
https://wordpress.org/plugins/fancy-facebook-comments/
https://wordpress.org/plugins/disable-comments/

Disable WordPress comments by adding custom CSS style

If none of the methods above works the way you want, you can always change your website’s CSS styles.

First, you need to find an element in your page which represents comments, and another one which represents a respond form. Usually, this would be a div element with id comments  and another div element of class comment-respond.new-box. You can find these values by accessing developer tools in your browser and discovering elements on your page. On Google Chrome, you can do this by pressing F12, or Ctrl + Shift + I. After the developer view pops up, you will want to (1) locate your part of the page where comments are and after that (2) clicking on them. You will get the element in the developer view, together with its attributes, such as  id  or  class  .

Wordpress Comments Settings

In CSS styles, you represent id’s by hashtag (#) and classes by dots (.).  Adjust the code below to your needs. Property display with value none means that even though comments will be rendered, they will not be displayed.

#comments, 
.comment-respond.new-box {
    display: none;
}

After you have your code, go to  Administration -> Appearance -> Customise -> Additional CSS , paste it there and hit Save & Publish button. Your WordPress comments will now be gone.

It may happen that after refreshing your page in browser, it will still have the same output. You need to clear your browser’s cache. In Google Chrome, you can simply press Ctrl + Shift + R, which reloads your page by ignoring cached files.

Disable WordPress comments by changing theme’s PHP files

This is the last way described in my article. I personally use CSS change described above, but it’s not the right thing to do. If your theme’s code allows you to easily (understand: by commenting out 2-3 lines of code) disable default WordPress comments, then you should do it this way. Generating comments, populating views and immediately hiding them with CSS is not the right approach. We’re talking about a few milliseconds here, still, it’s not the proper way of programming.

Let’s say that you want to disable comments on all post pages. Go to Administration -> Appearance  -> Editor and in the right list, look for a file that could represent your Post (or Single Post) page, for example:

Wordpress Comments Settings

Click on this page, which then opens in editor. Your task will be to find a comment section, almost at the end of the file. Comments are positioned at the end of your webpage too, hence the bottom position.  It might be a little difficult to find, but it should look similar to this example:

Wordpress Comments Settings

Facebook comments are the ones that Fancy Facebook Comments plugin added to our page. We want to display these and disable the default WordPress comments. Comment out all the lines by adding double-slash in front of each line. After you’re done, hit Update file button.

Again, it may happen that after refreshing your page in browser, it will still have the same output. You need to clear your browser’s cache. In Google Chrome, you can simply press Ctrl + Shift + R, which reloads your page by ignoring cached files.

Conclusion

By finishing the whole article, you should be able to disable your comments in 4 ways, whichever suits you the best. It is up to you which one fits to your problem, but you can go ahead and play with all of them. Have fun!

PS: To get a very nice comment snippet highlighting in WordPress, click here.

Rate this post

Vladimir Marton

Software Developer focused on Java, Python, PHP and SQL. Guidearea is my oldest project where I write articles about programming, marketing, SEO and others.

Add comment

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