Noscope is a bi-weekly journal serving up snacksized portions of pointless stuff since 2001. On a new linode server!
I also do freelance design and usability via dejligt.com

WordPress Trick: Remove Dashboard Widgets

    14:10 on March 23, 2010 ,

Want to remove some dashboard widgets programmatically? Perhaps to hide useless cruft from every role but the Administrator? Dump this in your themes functions.php:

function 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_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', 'remove_dashboard_widgets' );
}

This removes all dashboard widgets, so you’ll probably want to poke around and comment out some of these array unsets.

7 Comments

Comments

  1. Nice! Always wanted to implement this but never actually looked it up.
    thanks.

  2. Lloyd Budd (subscribed) says:

    Wrap this in a plugin and millions will love you ;-)

  3. Micah says:

    Will this speed WP up in any way? Or is it just a visual improvement?

  4. Joen says:

    It’s a visual change only. And it’s useful mostly to unclutter the wordpress interface for novice users.

  5. kamal (subscribed) says:

    huge tips, any one can to turn it to a plugin? :)

  6. WPFuss (subscribed) says:

    Nice tip!… Great for client projects.

  7. Matt Pealing says:

    Great post! Thanks.

    Just one problem, I found that this code didn’t remove the ‘Recent Drafts’ widget and that this code is necessary instead:

    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);

Leave a Reply

Have something to say? Jump right in!

(required)
(required)