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?
0
comments, dashboard, wp-admin
7 years
2016-01-05T07:42:53-05:00
2016-01-05T07:42:53-05:00 0 Answers
82 views
0
Leave an answer