Get the SEO Newsletter

Turn Off Comments in WordPress

Summary:
When you realize what everyone else has to say is boring, this'll be your next step. ;-)

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.

 
Bookmark and Share

30 Comments so far ↓

  1. Tristan Chambers says:

    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. matt wright says:

    this worked perfectly. thanks — matt

  3. Andy says:

    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. Andy says:

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

  5. stephanie says:

    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:)
    cheers
    steph

    • 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.

      • stephanie says:

        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…
        best
        dteph

  6. hastur says:

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

  7. brodhe says:

    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. Ashley says:

    “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. Ahoodie says:

    I just found the plugin that removes the comments (on all pages but not posts).
    http://wordpress.org/extend/plugins/no-comments-on-pages/

  10. Bart says:

    Thanks man, this is just what I need.

  11. Yeah, they should work.

  12. kerry says:

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

  13. Renato says:

    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.
    Renato.

    • 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.

  14. Izzy says:

    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. bernie says:

    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.
    Bernie

  16. chris says:

    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. matt says:

    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. Scott says:

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

  19. Sloan says:

    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!


Leave a Reply

Email is required but will not be published. All comments are moderated and no-followed. Please do not use keywords or domains as names and do not advertise.

Please keep comments directly related to the post topic or another commenters question. If you have a question not directly related to the post, try asking your question in the WordPress Forums or Our Forums.