Remove Comment Area Entirely

gauravtiwari

Blogger at https://gauravtiwari.org
Messages
110
Reaction score
42
Website
gauravtiwari.org
Hi, I am trying to remove the comment area entirely but

PHP:
add_action( 'init', 'remove_my_action');
function remove_my_action() {
if(is_singular(array('post', 'page')){
     remove_action( 'md_hook_comments', 'md_comments', 330 );
}
}
doesn't seem to work.

What should I try?
 

Alex

MD developer
Messages
5,174
Reaction score
1,261
From lib/functions/build.php you can grab the comments add_action hook and flip it to remove_action to get:

PHP:
remove_action( 'md_hook_content_item', 'md_comments', 60 );

Which fits perfectly into your logic above. Also I recommend you use the template_redirect hook over init as it is a more precise and predictable way of making template changes. Thank you for the great question.
 
Comment
Top