Web Design Tech Kitteh

Published on August 21st, 2013 | by charliesaidthat

17

How to Remove Disqus Comments from WordPress Pages

OK, lets hop straight to it. You’re probably annoyed that you can’t get those blasted Disqus comments off your about, contact or advertising pages and I don’t want to waste your valuable time.

Luckily as far as plugin hacks go, this is quite a straight forward job.

To keep you entertained… here’s a picture of a cat helping hack about in WordPress.

Comments On Pages? You've Got To Be Kitten Me

Removing Disqus Comments From WordPress Pages

1. First things first, you’ll want to open your FTP client (probably Filezilla) to locate the following folder: /wp-content/plugins/disqus-comment-system

2. When you get to this folder you are just looking for this file. /wp-content/plugins/disqus-comment-system/disqus.php

NB: For the record you can totally edit the file from the WordPress Plugin editor (Plugins>Editor>Disqus Comment System>Disqus.php), you’re probably best to hop into your FTP folder download the file, and upload the edited version of the disqus.php file yourself.

3. Locate the “Filters/Actions” headline in disqus.php -> a quick search using Ctrl+F should take you right where you need to be.

4. Scroll down under the “Filters/Actions” headline and locate the following line of code in disqus.php

if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
return;
}

if ( !dsq_is_installed() || !dsq_can_replace() ) {
return $value;
}

And then replace it with this code:

if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
return;
}

if ( !dsq_is_installed() || !dsq_can_replace() ) {
return $value;
}

if ( ('closed' == $post->comment_status) || ('page' == $post->post_type)){
return;
}

5. Save the changes to the disqus.php file and mosey on past your WordPress Pages. Hopefully it should be fixed at this point. IN which case, go grab yourself a well deserved coffee.

If like me, though now you have the WordPress default comments sitting there taunting you and your victory caffeine break, here’s how to turn them off.

To remove comments as a default from WordPress in your page templates

1. Get your FTP client set up and ready to go, and find the page templates you want to edit. This is usually page.php but you might have some custom templates.

NB: Again you can edit this in your WordPress Editor (Appearance>Editor>page.php), but you are better to do it via FTP so you can back everything up if you break all the things.

2. Find and remove the following line of code:

<?php comments_template(); ?>

3. Open up your WordPress pages and check that the comments are now gone.

4. ???

5. … Profit!!!


About the Author

Hi I’m Charlie, a digital strategist, I have an interest in social media, SEO, lead acquisition and understanding consumer behaviour to make a definitive difference to the businesses I work with. Find me on: Twitter | Instagram | Facebook | Linkedin | or just Email Me  



  • http://www.about.me/alexcequea Alex Cequea

    Thanks Charlie, this was very helpful :-)

  • GL2000

    No hacks or edits are required in the latest version of WordPress (not sure about earlier versions). You can just uncheck “allow comments” on the AddNew, Edit or QuickEdit pages in WordPress. Disqus will honor this setting and it also shuts off WordPress comments at the same time.

    To get the setting on the editor page, select Screen Options at the top and enable Discussion fields.

    • http://www.nixonvs.com/ Nixon Virtual Strategies

      Sorry GL2000 but that’s not true. I have the latest version of both Disqus and WordPress and it’s not working the way it should with your instructions.

      • sakshamcse

        Sorry, but its working for me. WordPress 4.0.1 running Graphene theme.

      • http://www.tinderseduction.com Marcus

        If there are comments already on the page, then Disqus will NOT be removed if you uncheck “Allow comments.”

        Therefore you need to uncheck “Allow comments” AND trash all the comments that have been made on that page.

        Hope this helps others – It took me a long time to figure this out as there was no answer anywhere else (and I Googled for an hour!).

        • http://www.nixonvs.com/ Nixon Virtual Strategies

          Wow! I posted that years ago and I was just updating my site yesterday and saw this comment again. Yes, I did just that and all is well.

    • Daniel Lucena

      Thanks… i found this option!

    • http://www.youtube.com/user/PrsnSinghHD Prasoon Singh

      Where at?

  • http://www.urboiphotography.com/ Lindsey Epps Tucker

    Appreciate this info Charlie, it was extremely helpful!

  • http://soutien-gorge-adhesif.be/ Soutien-gorge bretelles

    Thank you very much for your useful post.

  • http://me.damanbahner.com/ @Daman

    Worked like a charm, thanks!

  • chirisdex

    No hackers or modifications are needed in the newest edition of WordPress (not sure about previously versions). You can just uncheck “allow comments” on the AddNew, Modify or QuickEdit webpages in WordPress. Disqus will respect this establishing and it also turns off WordPress feedback simultaneously.

    +

    Spybubble gratis

  • http://achamess.github.io/ Alexander Chamessian

    Thanks so much. Just used this. Great stuff!

    • http://charliesaidthat.com/digital/ charliesaidthat

      More than welcome dude! :)

  • http://www.kayakonlinemarketing.com/blog Randy Milanovic

    Worked like a charm. Although, I did notice some stubborn pages wanted to insert the WP discussion/comment box.

  • http://www.odosta.com/ Tayyib Ahsan

    You can just quick edit the specified page, Where you don’t want to show comments and uncheck “Allow comments”, Enjoy.

  • http://www.hacker9.com hacker9

    The changes in Disqus.php will not persist if you update your Disqus Plugin. The best way to disable comments in pages is to create a filter in functions.php

    add_filter( ‘comments_template’ , ‘wpb_block_disqus’, 1 );
    function wpb_block_disqus($file) {
    if ( ‘page’ == get_post_type() )
    remove_filter(‘comments_template’, ‘dsq_comments_template’);
    return $file;
    }

    P.S

    If you want to disable it for custom post types, replace “page” with your “custom_post_type_name”

Back to Top ↑