Admin – Dashboard – Unset recent comments

Question

I try to get rid of the comments list in the WordPress 4 dashboard section but it doesn’t work.

Here is what I tried:

    function remove_all_dashboard_widgets() 
    {
        global $wp_meta_boxes;

        // these 2 are ok as they are not displayed anymore
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);

        // I tried both "recent" and "latest comments" with no success
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_latest_comments']);

        // I also tried these two with no success
        remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
        remove_meta_box('dashboard_latest_comments', 'dashboard', 'core');
    }
    add_action('wp_dashboard_setup', 'remove_all_dashboard_widgets');

The Quick press and Primary boxes are unset, so it works but the recent comments remain on the screen.

The example above were tested at the same time. I tried one by one, but it doesn’t work

I also tried to hide the section with CSS by adding:

#latest_comments {display:none !important;}

But it still doesn’t work.

Any idea?

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/admin-dashboard-unset-recent-comments/">

Admin - Dashboard - Unset recent comments</a>
0
, , Baylock 4 years 0 Answers 41 views 0

Leave an answer