HOW-TO: Disable DISQUS comments on WordPress pages

DISQUS is pretty neat, but there’s no built-in way to make it obey the WP setting of ‘Allow comments on this post’. After a quick search around, I figured it out.

  • Go to Plugins > Editor
  • Select plugin DISQUS Comment System
  • Edit the first file, ‘disqus-comment-system/disqus.php’

Around line 120 (you might need to copy this out into a text editor), add the following line.

if ( 'closed' == $post->comment_status ) { return false; }  

Thanks to Ted Aronson for the tip, found on this blog.

UPDATED: 4 Mar 2011, new line number for code as plug-in has changed.

UPDATED: 3 Sep 2011, tip no longer relevant, functionality appears to be built-in to Disqus for WordPress, see last comment below.

FacebookLinkedInRedditPrintFriendlyEmailShare/Bookmark
  • Pingback: HOW-TO: Disable DISQUS comments on Wordpress pages « wonald.com | Squico

  • Pingback: Patch Disqus Plugin Agar `Allow Comments` di WordPress Tetap Berfungsi | Soluvas

  • http://www.soluvas.com/ Hendy Irawan @ Soluvas

    Thanks, this is a very useful tip for Disqus. I’ve been looking for this.

  • http://www.ninjafiles.net NiNJADMiN

    Thanks, this is a very useful tip for Disqus. I’ve been looking for this. and this would seem affective. This seems like the most comprehensive blog on this niche

  • http://www.nileshbabu.com/ nileshbabu

    this is helpful! thx!

  • http://macpress.org MacPress

    great share, thank for post, very useful for blogger

  • Jennifer Wilson

    Worked like a charm. I’ve also been looking for a solution to this. Thank you for sharing.

  • http://www.tonesweb.co.uk Nick Tones

    cheer for this!

  • http://www.hermestechnologies.ie/index.php/blog Jack Kinsella

    Thanks for the hack – I added the line at 106, just above if ( ‘draft’ == $post->post_status ) { return false; }. I wish they’d just include this as an option on the DISQUS settings

  • http://BigSquidmedia.com/ Mike Greco

    SUCCESS!!! Input the code given on line 106, just like Jack says!

  • http://www.thesocialden.com/ The Social Den

    It worked for me on line 105. They should really build this into the plugin! I hope it doesn’t break on the next upgrade…

  • http://www.andytraub.com Andy Traub

    ADD TO LINE 106 ABOVE – IF( ‘DRAFT’ == …..

    Thanks…

  • http://www.andytraub.com Andy Traub

    Glad I could help. Have a wicked great Friday.

  • Disqu

    Disqus is shit and should be banned

  • http://littenburg.com Littenburg

    Tried it, it seems between lines 120/121 is best now as several changes have happened. thanks a bunch!

  • http://www.andytraub.com Andy Traub

    From Littenburg a few comments down – Tried it, it seems between lines 120/121 is best now as several changes have happened.

  • http://wonald.com Ronald

    Thanks for the update guys!

  • http://www.laptops-battery.org.uk/COMPAQ/COMPAQ-Tablet-PC-TC100-Battery Zhangjianqin2011

    It’s really wonderful,Thanks for sharing

  • http://mindsparker.com Dolphin

    UPDATED: 4 Mar 2011, new line number for code as plug-in has changed.

    At which line should I put now ?

  • http://wonald.com Ronald

    Line 120, or thereabouts. Still working for most I assume.

  • http://www.1weblognevis.com/ Masoud Golchin

    thank you

  • http://www.HookedonOverages.com Rick Dawson

    Nice.  Seems like such a basic feature that should be front and center.

  • Anonymous

    Thank you so much! That was driving me crazy.

  • http://freshairoahu.com Aaron

    My WP builder does not have “allow comments on this post or page option” in a single page post. How do i exclude disqus comments on a single page and not remove it entirely?

  • http://www.andytraub.com Andy Traub

    Try this: Open the page you want to edit in “edit mode”.  Look for “Screen Options” on the top right and click on it.  Click the “Comments” box and then close the screen options dialogue.  You should be able to turn off and on comments BELOW your page text now.  

  • http://freshairoahu.com Aaron

    When I went to look the box was already unchecked so Disqus doesn’t seem to be taking commands. Where else could I look?

  • http://www.andytraub.com Andy Traub

    sorry bro…maybe ask my friend – @studionashvegas is his twitter handle.  Wordpress stud.

  • http://wonald.com Ronald

    Hey Aaron and anyone else happening across this blog post, it seems the tip is no longer relevant. I’m not sure when it changed but as of WordPress 3.2.1 with Disqus plugin version 2.66, this custom code is no longer necessary. Disqus will recognise the ‘Allow Comments’ field being unticked without requiring editing of the plugin files.

    I just tested this on the page on my own site.

    Cheers guys,

  • http://blog.trwolfe.com T.R. Wolfe

    Do you mean within the actual Page or Post editing pages?

  • http://blog.trwolfe.com T.R. Wolfe

    After checking both pages and posts, the “Allow Comments” field only appears on the posts, and not pages.

  • http://wonald.com Ronald

    WordPress v3.2.1, Disqus plugin v2.67. The ‘Allow Comments’ field is definitely there in Full Edit for a post in the ‘Discussion’ panel for both posts and pages, see the image linked below, that’s what I see when editing a page in WordPress now.

    http://wonald.com/wp-content/uploads/2011/09/allow-comments-page.png

  • http://blog.trwolfe.com T.R. Wolfe

    Ahhh, thanks.  What happened was I had the “Discussion” panel hidden within the Screen Options.  Thank you!

  • Shantanu Tewary

    thanks for the same, but if you could please guide, how the remove disqus from pages other than post.

  • http://www.facebook.com/profile.php?id=508054727 Herrin Larkan

    or you could use CSS.

    e.g.

    .page-id-1045 #disqus_thread {display:none;}

  • http://wonald.com Ronald

    Sure, that’s also an option.

  • http://aptsonic.com/ Jason A. Howie

    Thank you!

  • http://www.probowlingsystem.com/ Melissa Muniz

    I’ve been looking for this. and this would seem affective. This seems like the most comprehensive blog on this niche.

  • http://www.webuygoldbk.com/ Brenda Erwin

    Thank you for sharing.

  • http://www.sunnylimos.com/ Weisskhl

    it obey the WP setting of ‘Allow comments on this post’. After a quick search around, I figured it out.

  • http://www.propertygoldrush.com/ Teresa Courtney

    I’ve been looking for this. and this would seem affective. This seems like the most comprehensive blog on this niche

  • http://keavenylaw.com/ Kelly Ames

    This seems like the most comprehensive blog on this niche

  • http://radiology-technician-guide.com/ Theresa Espinosa

    I figured it out.

  • http://www.apartmentsba.com/ Lori Costello

    They should really build this into the plugin! I hope it doesn’t break on the next upgrade…

  • http://www.undergroundproductz.com/ Dominique Paulson

    I’ve also been looking for a solution to this. Thank you for sharing.

  • relensi

    hi, I’m using disqus on my website. However it seems to be causing a conflict on the homepage slideshow (even though I don’t render comments on the homepage).
    Is there a way to stop discuss from rendering any scripts on the homepage. I would like to limit disqus to only a few posts or pages. Kindly help me.

    Regards

  • http://sex-hot-indo.blogspot.com/ videosex

Switch to our mobile site