Clean Up WordPress Dashboard Widgets

How to Clean Up WordPress Dashboard Widgets

in WordPress Admin
Google+ LinkedIn

WordPress admin dashboard comes with many widgets out of the box. But unnecessary WordPress dashboard widgets can be confusing for new users or clients inexperienced in using WordPress. It could be a little overwhelming for them at first time they log in. Clean up WordPress dashboard can also help you simplify WordPress for users of your Multisite network. There are a couple of ways to clean up the WordPress admin panel and remove dashboard widgets.

Fortunately, getting rid of WordPress Dashboard Widgets is pretty easy. Just open up the “Screen Options” tab at the top right of your admin screen and uncheck the boxes that you don’t want to see. It’s as easy as that. It’s one way to hide WordPress dashboard widgets. The other way is to write a function to disable these widgets completely.

When added to the theme’s functions.php file, this code will disable all default widgets in the WP Dashboard. It’s drastic, so be sure to comment out or remove any lines that aren’t required.

// clean up wordpress dashboard widgets
function wcs_remove_dashboard_widgets() {
    global $wp_meta_boxes;
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action( 'wp_dashboard_setup', 'wcs_remove_dashboard_widgets' );

If you want to disable these WordPress dashboard widgets for all users except WordPress administrators then use this following code snippet instead.

// clean up wordpress dashboard widgets
function wcs_remove_dashboard_widgets() {
    global $wp_meta_boxes;
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
if ( !current_user_can( 'manage_options' ) ) {
    add_action( 'wp_dashboard_setup', 'wcs_remove_dashboard_widgets' );
}

Share the love

If you like this snippet, share it with others!

Leave a Reply

Your email address will not be published. Required fields are marked *