by Chris Coyier & Jeff Starr

Disable Default Dashboard Widgets

Posted by Updated on

This is an exclusive guest post by , posted on February 10th, 2014.

Continuing with tips for customizing the WordPress Dashboard, here is a look at one way to remove unwanted widgets and clean up the default WP Dashboard.

Using WordPress to build sites like Plugin Planet, it's usually necessary to customize the Dashboard by removing some default widgets and adding some of my own. No big deal, but the code required to disable the default widgets seems to evolve along with WordPress. So if you have any sites where you've disabled default dashboard widgets, it may be worthwhile to check that the code is still working. Either way, here is a function that works great with current WordPress (3.8):

	Disable Default Dashboard Widgets
	@ https://digwp.com/2014/02/disable-default-dashboard-widgets/
function disable_default_dashboard_widgets() {
	global $wp_meta_boxes;
	// wp..
	// bbpress
	// yoast seo
	// gravity forms
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets', 999);

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.

The code itself is straightforward, basically a function that uses unset to disable the default widgets, "Recent Activity", "Right Now", and so forth. Note that the last line in the function is to disable the default bbPress widget (remove if not needed). Lastly the function is hooked into WordPress via wp_dashboard_setup. That's all there is to it, just add the code to your theme's functions file (or plugin or whatever) and done. At least, until things change again.

Update: added lines to disable dashboard widgets for Yoast SEO and Gravity Forms.


The old way uses remove_meta_box() for each widget, for example:

remove_meta_box('dashboard_right_now', 'dashboard', 'core');
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');

I've seen other techniques as well, but I think with 3.8 going the unset methodology seems the way to go.

6 Responses

  1. Great tip. Worked perfectly. I love to have my WordPress Dashboard clean and tidy so this was right up my street.

  2. why is using global variables considered a better way? remove_meta_box seems much nicer and cleaner. are there any reasons the long and less readable unset $wp_meta_boxes... code should be used?

    • Jeff Starr

      It seems that way to me too, but the unset method is what works for me using current versions of WP.

  3. Awesome tip, worked perfectly. Thanks!

  4. For the copy and pasters out there… there is an extraneous apostrophe within ['yoast_db_widget'']. Otherwise, great tip. Thanks!

Comments are closed. Contact us with any critical information. Thank you!

Code is poetry