Skip to content

Instantly share code, notes, and snippets.

@richstrauss
Last active October 10, 2016 13:18
Show Gist options
  • Save richstrauss/9ce1ea1ebe97b09ad63bb6438ecba429 to your computer and use it in GitHub Desktop.
Save richstrauss/9ce1ea1ebe97b09ad63bb6438ecba429 to your computer and use it in GitHub Desktop.
Remove Disqus Comments from Custom Post Types
<?php
// Remove Disqus from Courses custom post type
add_filter( 'comments_template' , 'wpe_block_disqus_courses', 1 );
function wpe_block_disqus_courses($file) {
if ( 'sfwd-courses' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}
// Remove Disqus from Lessons custom post type
add_filter( 'comments_template' , 'wpe_block_disqus_lessons', 1 );
function wpe_block_disqus_lessons($file) {
if ( 'sfwd-lessons' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}
// Remove Disqus from Topics custom post type
add_filter( 'comments_template' , 'wpe_block_disqus_topics', 1 );
function wpe_block_disqus_topics($file) {
if ( 'sfwd-topic' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment