Turn Off Comments in WordPress

A while back I wanted to do something with WordPress that seemed like it should be the easiest thing in the world to do, like there should be a setting or something to change to turn off comments, but my search ended in disappointment at the thought that I would have to scrounge through and remove all the code that displays comments…I really hate when things aren’t made easy for me.

Anyway, here’s how it’s done…

1. Open index.php and remove this:

<span class="add_comment"><?php comments_popup_link('? No Comments', '? 1 Comment', '? % Comments'); ?></span>

2. Open single.php and remove this:

<?php comments_template(); ?>

3. Open archive.php and remove this:

<?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>

That’s it, you’re done, unless you have another theme that you’re using, in which case you need to scan all your blog pages for anything related to comments. If you find something, open whatever template that page is using and remove any lines of code like what’s above.

  1. I’m using pages on my site, so I had to do the same in page.php. I commented out the code in . Works great!

  2. this worked perfectly. thanks — matt

  3. You are the man! Same thing, searched all over the place to turn them off globally. I was shocked it wasn’t already an option in WordPress.

    I honestly don’t give a crap what people have to say about my portfolio site, so I want them off. 8-)

  4. Oh hey, I do find it ironic though that you still have comments enabled on this page! 8-)

  5. hi,
    i had the same problem. now that i have them all off, the customer wants only at one special place a comments field.
    so i found out, when i turn them on, they will be everywhere, no matter how hard i hit the off checkboxes in settings:(

    do you happen to have a php code to turn it off individually in every psge (since i installed the exec-php plugin)…
    would be great:)

    • Hi Stephanie, you say you tried the setting to turn off individual comments in the edit post page? If that’s not working you’ve got another problem. Without that option you’d have to use an if-statement to check if the page# is one that you want to show comments on and only then include the comment function call.

      • hi john, thanks for your answer and your advice!
        i meanwhile found a way doing it;
        i link the”home” (which i just call differently) to the posts (blog), and all other menu items to pages (with no comments). now its fine, but anyway this theme (detour) i’m working with seems not to function right in the way clicking on or off the comment/ping checkbox…

  6. This worked wonderfully. As the Elder Gods care little for the comments of humans.

  7. I want to remove the ability of commenting and also the ‘comments off’ appearance.

    my main problem is that my ‘index’ doesn’t show this line of code as it is, and i don’t have a ‘single.php’ item

    • You just need to search your theme files for either of those two functions (comments_popup_link or comments_template) and delete them.

      One of those two should be showing up anywhere you see anything related to comments.

  8. “seemed like it should be the easiest thing in the world to do,”

    I couldn’t agree more. Thank you so much. I have been ripping my hair out for hours trying to find a simple way to do this. Your advice is very much appreciated!! Worked perfectly!

  9. I just found the plugin that removes the comments (on all pages but not posts).

  10. Thanks man, this is just what I need.

  11. Yeah, they should work.

  12. Thank you, i have been looking everywhere to remove comments!! Massive help.. Thank you!

  13. I was also looking everywhere how to do this and found that there is a way to turn it off. You can turn off comments by editing a post or page in wordpress. Go to each page and post where you want to turn it off and select quick edit: You’ll see a “allow comments” checkbox. Uncheck it and update the post / page.
    If you want to do many at once, you can use the bulk action. Select the items you want to change on the “pages” or “posts” page and then select as action “edit” , hit “apply” and you’ll get lie in “quick edit” a small pane that allows you to decide what to do.

    • That’s true Renato, but in most themes that will result in a something along the lines of “Comments are disabled on this post” appearing at the end of every page/post.

      That’s not something most people want if comments are totally disabled.

    • Thank you so much Renato!!! I was going crazy trying to find how to turn the comments off on Pages while leaving them on Posts. I didn’t want to touch the code for my theme; I just wanted a box to check or uncheck and couldn’t understand why there wasn’t one when I wrote the post.

      Thanks to the theme I use (Suffusion) I don’t have the annoying “Comments are disabled on this post” line at the end of each post so your answer is exactly what I am looking for. Thanks!!!

  14. Great post. I too spent 15 minutes searching everywhere for this simple “Off” button but couldn’t find it!! I can’t believe that WordPress hasn’t thought of this or wont implement it – clearly there are benefits to them if we leave comments up.

    Thanks for your help – It saved me having to dig around in the code!!

  15. Great find. Should have thought of commenting out the comments before. Thanks soo much. stupid spammers, just ruin everything that is good about the net. :(

    Well, I’ll make sure to post a link to this.

    Thanks again.

  16. will this remove existing comments? im so sick of spam comments, they dont get published but still they annoy me, but i would like to leave the genuine comments i have already.

    Cant beleive this isnt a simple thing in setting :o

  17. WordPress 2.9.2 (current version at the time of this post) has a setting built in to turn off comments. On “Dashboard” click “Settings” and sub-menu “Discussion” and uncheck “Allow people to post comments on new articles” and save changes.

    • That’s true matt…and while this post was originally written over 2 years ago, I believe that setting still results in the “Comments are disabled on this post” message being displayed (by default). Isn’t that correct?

  18. Thanks mate I looked for ages to find a simple tutorial how to do this. Your solution worked a treat

  19. I started getting tons of spammy comments lately and very few legitimate comments so I just took your advice and got rid of it all. Worked great! Donthca think WordPress would just have a button called: “Turn off Comments”? Thanks again.

  20. @Scott, @Sloan: Glad you found it useful!

    • Thanks! For my site i simply removed the comment line from the index.php file and that was all i needed. I also can’t believe that this is not made easier by default in wordpress.

      Also anyone find it ironic that this article to remove comments allows comments? ;)

  21. Worked excellent, thanks!!


  23. Hi John,
    Thanks for this solution.
    Question Though, Would it have the same effect if the
    lines of code were just “Commented Out” like.

    <!–Commented Out By ?? Date ??–>

    If this is an alternative it would be a lot easier to reverse.

    What do you think.


    • Try it. It may work. Although PHP is parsed before the HTML gets sent to the browser, so you’ll end up still rendering all that function has to render, it’ll just be commented out. However, if there are any comments in the output of that function, they could prematurely close your comment and then you’d end up with trouble.

      Alternatively you could add a php comment like so:

      <?php //commentfunctionhere(); ?>

  24. Thanks John,

    I found it strange also that wordpress did not have an option to delete comments on pages. You have shown me how to sort this. Thanks; it makes sense to put comments on blogs posts but not on pages.

    • Yeah, I don’t like comments on pages in most cases…my themes used to have them removed from pages, but the WordPress.org theme directory requires they be enabled. At least it’s fairly simple to remove.

  25. its easy to rid it through easy one step..
    1) page.php and move to 24the line
    and disable it.

  26. Enabling and Disabling comments using the Discussion module

    To change the comment settings for a post or page you already published, open it for editing. In your Dashboard, go to either Pages or Posts, locate the one you want to edit, and click on its title.

    Then, locate the Discussion module on the edit screen, and either check or uncheck the two options it offers:

    To prevent any kind of discussion, uncheck both boxes.
    To disable the ability to use the comment form, but allow comments as Pingbacks or Trackbacks from other blogs, uncheck the box that says Allow comments, and leave the other box checked.
    To allow visitors to compose comments on the page but prevent responses from coming in as Pingbacks or Trackbacks from other blog, uncheck the box that says Allow Trackbacks and Pingbacks, and leave the other box checked.

    Make sure to save the post after you change any comment setting.

    These settings will prevent any kind of discussion on the post or page – the comment form won’t be shown and pingbacks and trackbacks will be ignored

    Can’t find the Discussion module?

    The edit screen on your blog is highly customizable. You can move modules around, minimize them, or hide them completely, so this module might not always be in the same place on every blog.

    By default, new blogs on WordPress.com will have the Discussion module hidden. You can reveal it by clicking on Screen Options on the top right, and checking the box that says Discussion.

    See the Screen Options support page for more information about this.

  27. does this work on wordpress.com?
    where can I find the index.php?

    • No apparently it doesn’t work on WordPress.com. However I have purchased a premium theme for my WordPress.org blog, and I am wondering if I can also use the same theme for my WordPress.org blog….anyone got any ideas about how to do that?

  28. Very simple & easy. Nice info John. Thanks

  29. Good guide John, I don’t have trouble with this myself, however I often have trouble explaining to clients how to do it, so this is a useful resource

  30. Awesome guide. I’ve wanting to turn of the comments section for a while now. Thanks again. You just earned yourself a blog follower! :)


Razorlight Media
Phone: 513-549-7355
Fax: 866-377-4331
cash, check, credit card, invoice, paypal
2207 Kemper Lane
Cincinnati, OH 45206
700 West Pete Rose Way, #68
Cincinnati, OH 45203