how to disable disqus for custom post types in wordpress

how to disable disqus for custom post types in wordpress

Earlier we also used disqus comment system. But now we stopped using disqus. Disqus comment system is most powerful and popular third-party comments tool. this tool is really great. With disqus you don’t need to worry about spam comments. Some times we faced slowness with disqus comments system so we stopped using disqus comments system.

If you want to use disqus comment system then go to following URL and download from here

Disqus Comment System

Disqus, pronounced “discuss”, is a service and tool for web comments and discussions. Disqus makes commenting easier and more interactive, while connecting websites and commenters across a thriving discussion community. The Disqus for WordPress plugin seamlessly integrates using the Disqus API and by syncing with WordPress comments.

how to disable disqus for custom post types in wordpress

If you are creating premium theme. Or you are trying to create the wordpress theme for your client than you need to control everything through your theme control panel. Using following code you can easily control disqus comment system through your wordpress theme code.

how to disable disqus for custom post types in wordpress
how to disable disqus for custom post types in wordpress

We given step for disable disqus for custom post types in wordPress with code.

What you need is, just copy and paste following code in functions.php file (wordpress theme).  Use following code.

add_filter( 'comments_template' , 'wpb_block_disqus', 1 );
function wpb_block_disqus($file) {
if ( 'custom_post_type_name' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}

Note: do not forget to change the “custom_post_type_name” name as per your custom post name.
Above code will check for custom post type and if current post with given custom post name than disqus comments will be disabled. This is safe way to disable disqus comments for custom posts.

You can use the Appearance ->Editor option also. Open functions.php file in Editor and at end of file Just put above code.

Following are some Useful article related to wordpress comments:

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.