Gut testen, funktioniert je nach Setup nicht.
PHP
// Kommentare komplett deaktivieren
add_action('admin_init', function () {
// Kommentarseite umleiten
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_safe_redirect(admin_url());
exit;
}
// Kommentar-Metabox im Dashboard entfernen
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
// Kommentare und Trackbacks für alle Post-Types deaktivieren
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// Kommentare und Pings im Frontend schliessen
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Bestehende Kommentare ausblenden
add_filter('comments_array', '__return_empty_array', 10, 2);
// Kommentarseite aus dem Admin-Menü entfernen
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// Kommentar-Link aus der Admin-Leiste entfernen
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});