Disqus is our go-to for all comment moderation when theming our websites for clients. Without going into all the reasons why. I have only found one caveat of using it and I’d like to share a workaround that resolves the issue 🙂

The Problem

Disqus hijacks the native WordPress commenting system. More times than not this is acceptable and the way it should work. BUT when using an e-commerce solution like Woocommerce it too relies on the WordPress commenting system. To integrate it’s rating and reviews.

The Solution

We can add a simple filter to our themes functions.php file which will remove Disqus. Based on any Custom Post Type we’d like, in this case, ‘products’.

The Code

// Disable Disqus for the 'product' Custom Post Type
add_filter( 'comments_template' , 'block_disqus', 1 );
function block_disqus($file) {
if ( 'product' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}

If you’d like to disable disqus on another custom post type change:

if ( 'product' == get_post_type() ) 

to

if ( 'your custom post type name goes here' == get_post_type() )

 

Originally published on

Leave a Reply

Your email address will not be published. Required fields are marked *

Have Any Questions?

Speak with a
Digital Expert

  • Looking to increase leads?
  • Maximize profits?
  • Redesign your website?
  • Sell Online?
  • Build an App?

Let's Discuss Your Next Project

  • This field is for validation purposes and should be left unchanged.