WordPress Cap Top
Wordpress Hacker
 
Alt tag

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.

Print Print Email Email

15 Responses to “Turn Off Comments in Wordpress”

  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.

Leave a Reply




 
WordPress Cap Top