When you create a Websites with WordPress, in general you do not need dashboard filled with useless junk like “WordPress Events and News”, “Quick Draft”, “Welcome” widgets. This short article will explain you how to remove this stuff from the WordPress dashboard.
Place the necessary code snippets in your WordPress theme functions.php file or a “must use” plugin. Theme functions.php file may get huge over time, therefore for such optimizations I often create a separate “must use” plugin (a php file in /wp-content/mu-plugins/ directory) where I place all of the code snippets, so I always know that they are organized in one specific place.
If you need to use multiple of these code snippets – see the sample at the end of this article. Copy/paste it and edit out unnecessary parts.
WordPress Events and News
Who would ever want to read news about WordPress in their site dashboard? No one.
add_action('admin_init', function() {
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // Removes "WordPress Events and News" dashboard widget
});
Quick Draft
In my experience there haven’t been a single situation when “Quick Draft” option would become useful to the WordPress users.
add_action('admin_init', function() {
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Removes "Quick Draft" dashboard widget
});
WooCommerce Setup
Use this if you have the WooCommerce installed to remove the “WooCommerce Setup” widget from the WordPress dashboard. Often there is situations when “classic” WooCommerce setup guide steps are not required, therefore this widget becomes useless.
add_action('wp_dashboard_setup', function() {
remove_meta_box( 'wc_admin_dashboard_setup', 'dashboard', 'normal'); // Removes the "WooCommerce Setup" dashboard widget (if you have WooCommerce installed)
}, 40);
WordPress “Welcome” panel
WordPress “Welcome” panel often contains brief information about the features available in your WordPress version. Often it is already hidden by users (as there is an actual “Dismiss” option for it), but to ensure that it stays that way and can’t be enabled, use this code snippet:
add_action('admin_init', function() {
remove_action('welcome_panel', 'wp_welcome_panel'); // Removes WordPress "Welcome" dashboard widget
});
Remove all of the mentioned WordPress dashboard widgets
Use this code to remove all of the mentioned WordPress dashboard widgets. If you need to remove only some just edit out the unnecessary parts.
add_action('admin_init', function() {
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // Removes "WordPress Events and News" dashboard widget
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Removes "Quick Draft" dashboard widget
remove_action('welcome_panel', 'wp_welcome_panel'); // Removes WordPress "Welcome" dashboard widget
});
add_action('wp_dashboard_setup', function() {
remove_meta_box( 'wc_admin_dashboard_setup', 'dashboard', 'normal'); // Removes the "WooCommerce Setup" dashboard widget (if you have WooCommerce installed)
}, 40);