How to remove a widget from the WordPress Dashboard permanently

- by

widget-be-goneIf you want to never see a widget on your WordPress Dashboard ever again, just head over to the top where it says “Screen Option”, then simply un-tick the ones you don’t like.

That’s Zen Therapy right there. These preferences are saved on a per-user basis.

But what if you don’t want certain widgets to show up, because your client gets confused by all the dashboard clutter? I know I do!

Help is at hand: you can use a couple of neat functions in your theme (or plugin) so certain widgets never even show up. Let’s see how this works.

What WordPress calls Widgets

By default, you have four widgets on the left, and four on the right hand side in the Dashboard. The left hand side is known as “normal”, and the right hand side is known as “side”. You need to know which side your widget is on.

You also need to know what a Widget is called. Here’s a list of each Widget’s title, what WordPress knows it by and which side it appears on:

Right Now

  • dashboard_right_now
  • normal

Recent Comments

  • dashboard_recent_comments
  • normal

Incoming Links

  • dashboard_incoming_links
  • normal

Plugins

  • dashboard_plugins
  • normal

Quick Press

  • dashboard_quick_press
  • side

WordPress Blog

  • dashboard_primary
  • side

Other News

  • dashboard_secondary
  • side

Now that we know how to address those suckers, let’s see how we can eliminate them for good.

Here’s how to get rid of “Plugins” and “Other News”. This code can be used in your theme’s functions.php file, or in a plugin.

//Remove unwanted widgets from Dashboard
function remove_dashboard_widgets() {
	global$wp_meta_boxes; 
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
	unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');

The two lines starting with “unset” are the important ones: the last parameter defines the widget, and the parameter before “core” tells WordPress which side (left or right / normal or side) we’d like to remove it from.

Remove as many widgets as you like simply by copying the entire line starting with “unset”, and then replacing title and side accordingly. To bring them back, simply delete the code from your functions.php file.

If you’d like to know more about WordPress Widgets, check out the API documentation: http://codex.wordpress.org/Dashboard_Widgets_API



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

19 thoughts on “How to remove a widget from the WordPress Dashboard permanently”

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.