// ===== BLOK TOTAL KOMENTAR WORDPRESS =====
// 1. Matikan fitur komentar di semua post type
add_action(‘init’, function() {
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, ‘comments’)) {
remove_post_type_support($post_type, ‘comments’);
}
if (post_type_supports($post_type, ‘trackbacks’)) {
remove_post_type_support($post_type, ‘trackbacks’);
}
}
});
// 2. Tutup komentar di front-end
add_filter(‘comments_open’, ‘__return_false’, 20, 2);
add_filter(‘pings_open’, ‘__return_false’, 20, 2);
// 3. Sembunyikan komentar yang sudah ada
add_filter(‘comments_array’, ‘__return_empty_array’, 10, 2);
// 4. Blok submit komentar (anti bot)
add_action(‘pre_comment_on_post’, function() {
wp_die(‘Komentar dimatikan.’);
});
// 5. Hapus menu komentar di admin
add_action(‘admin_menu’, function() {
remove_menu_page(‘edit-comments.php’);
});
// 6. Redirect halaman komentar
add_action(‘admin_init’, function() {
global $pagenow;
if ($pagenow === ‘edit-comments.php’) {
wp_redirect(admin_url());
exit;
}
});
// 7. Hapus icon komentar di admin bar
add_action(‘admin_bar_menu’, function($wp_admin_bar) {
$wp_admin_bar->remove_node(‘comments’);
}, 999);

