Home » PHP/MySQL, WordPress » Remove Dashboard Widget Boxes (Meta Boxes) from WordPress and Network Admin Dashboard

2

WordPress, by default shows a number of Widget Boxes in it’s admin homepage a.k.a the dashboard. These boxes are called Meta Boxes and shows Incoming Links, Plugins Feed, WordPress.org News and other WordPress news. Since WordPress 3.1, the Network features are managed through a Network Admin Dashboard accessible to the Super Admins. This Network Admin Dashboard also features these Meta Boxes.

We can pro grammatically remove these boxes. Use the below pieces of code in your theme’s functions.php or in your plugin or wherever you are overriding WordPress functionality.

To remove the Meta Boxes from the WordPress Dashboard:

//Define the function which unsets the boxes
function remove_dashboard_widgets() {
        global $wp_meta_boxes;
        # Remove plugins feed
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_plugins']);
        # Remove "WordPress News"
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_primary']);
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_secondary']);
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
        # Remove incoming links feed
        unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
        unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_incoming_links']);
}
// Now hook in to the action
add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20, 0);

To remove the Meta Boxes from the WordPress Network Admin Dashboard:

//Define the function which unsets the boxes
function remove_network_widgets() {
        global $wp_meta_boxes;
        # Remove "WordPress News"
        unset($wp_meta_boxes['dashboard-network']['side']['core']['dashboard_primary']);
        unset($wp_meta_boxes['dashboard-network']['side']['core']['dashboard_secondary']);
        unset($wp_meta_boxes['dashboard-network']['normal']['core']['dashboard_primary']);
        unset($wp_meta_boxes['dashboard-network']['normal']['core']['dashboard_secondary']);
}
// Now hook in to the action
add_action('wp_network_dashboard_setup', 'remove_network_widgets', 20, 0);

2 Comments

  1. John says:

    Thank you,how to remove other widgets

  2. Solai Luke says:

    It is a interesting post! Appreciate your the idea! Together with best regards Luke aka couchgool.

Leave a Reply

Page optimized by WP Minify WordPress Plugin