How to Remove WordPress Dashboard Widgets


Have you ever worked on a project which required you to customize the display of the WordPress admin panel? Well one of the first things consultants customize is the WordPress Dashboard. We showed you a quick example of how to add custom dashboard widgets in WordPress. In this article, we will show you how to remove WordPress dashboard widgets.

Note: If you ended up on this article looking for how to remove dashboard widgets just for yourself, then you should probably look at our article: How to Customize WordPress Admin Area (Dashboard) for Beginners

All you have to do is simply paste the following code in your theme’s functions.php file. Although it maybe a good idea to save this file as a plugin and make it a drop-in plugin.

  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']);    }    add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );    

Each of the widgets listed above are pretty self-explanatory. You can keep the ones you want by simply removing them from the list. If you want to remove these widgets from all users except for admins, then just change the last line to this:

  if (!current_user_can('manage_options')) {  	add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );  }  

We hope that this article helped you remove the default dashboard widgets in WordPress.