Remove default widget from the dashboard in WordPress

The majority of the default dashboard widgets are not necessarily all useful and will turn disaster for your non-tech clients. Well, here in this snippet to remove dashboard widgets.
Paste this to your function.php file in the child theme.

// Create the function to use in the action hook

function wps_remove_dashboard_widgets() {

   // Globalize the metaboxes array, this holds all the widgets for wp-admin
	   global $wp_meta_boxes;
	
	    // Main column (left): 
	    // Browser Update Required
		unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_browser_nag']); 
		// PHP Update Required
		unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_php_nag']); 
		
		// At a Glance
		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
		// Right Now
		unset($wp_meta_boxes['dashboard']['normal']['core']['network_dashboard_right_now']);
		// Activity
		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
		// Site Health Status
		unset($wp_meta_boxes['dashboard']['normal']['core']['health_check_status']);
		
		// Side Column (right): 
		// WordPress Events and News
		unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
		// Quick Draft, Your Recent Drafts
		unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
		// Remove Welcome panel
		remove_action('welcome_panel', 'wp_welcome_panel');
		
}
// Hoook into the 'wp_dashboard_setup' action to register our function

add_action('wp_dashboard_setup', 'wps_remove_dashboard_widgets' );

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top