Remove dashboard widgets

Remove dashboard widgets

Introduced in WordPress 2.7, dashboard widgets can be pretty useful. For example, some can display your Google Analytics stats. Though, sometimes you don’t need it, or at least don’t need some of them.

The code below will allow you to remove WordPress’ dashboard widgets once you paste it in your functions.php file.

function example_remove_dashboard_widgets() {

// Globalize the metaboxes array, this holds all the widgets for wp-admin

global $wp_meta_boxes;

// Remove the incomming links widget

unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]);

// Remove right now

unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]);

unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]);

unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]);

}

// Hoook into the ‘wp_dashboard_setup’ action to register our function

add_action(‘wp_dashboard_setup’, ‘example_remove_dashboard_widgets’ );