//comment disable code
/* 1. Disable Comments on ALL post types */
function updated_disable_comments_post_types_support() {
$types = get_post_types();
foreach ($types as $type) {
if(post_type_supports($type, 'comments')) {
remove_post_type_support($type, 'comments');
remove_post_type_support($type, 'trackbacks');
}
}
}
add_action('admin_init', 'disable_comments_post_types_support');
/* 2. Hide any existing comments on front end */
function disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter('comments_array', 'disable_comments_hide_existing_comments', 10, 2);
/* 3. Disable commenting */
function disable_comments_status() {
return false;
}
add_filter('comments_open', 'disable_comments_status', 20, 2);
add_filter('pings_open', 'disable_comments_status', 20, 2);
Comments
Post a Comment