Kommentarverwaltung im Backend deaktivieren

Achtung! Dieser Code ist Bestandteil des Plugins image² Standard Cleanup

Deaktiviert die Kommentarverwaltung im Backend:

  • Leitet den Zugriff auf „Kommentare“ automatisch ins Dashboard um
  • Entfernt das „Letzte Kommentare“-Widget im Dashboard

Praktisch für:

  • Business-Seiten ohne Blog-Kommentare
  • Systeme mit komplett deaktivierter Kommentarfunktion
  • interne Tools

<?php
add_action('admin_init', function () {

    global $pagenow;

    // Redirect if someone tries to access comments page
    if ($pagenow === 'edit-comments.php') {
        wp_safe_redirect(admin_url());
        exit;
    }

    // Remove comments widget from dashboard
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');

});

add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
}, 999);
?>