
There are several tutorials available in the internet showing how to remove dashboard widgets in WordPress. All of them use the Dashboard Widgets API, the solution is very similar to the following code (get from the Codex):
function example_remove_dashboard_widgets() {
// Globalize the metaboxes array, this holds all the widgets for wp-admin
global $wp_meta_boxes;
// Remove the quickpress widget
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
// Remove the incoming links widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
}
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
In my opinion, this is not a good approach. We touched the global WP variable $wp_meta_boxes, spent time finding keys for the widgets, and removed just by unset its value.
At a coder’s point of view, I would like a function that handles all of this stuff, or making the job simpler.
Fortunately, I found that dashboard widgets are also meta boxes. They just appear in a special place. That mean we can use meta box functions remove_meta_box() on them.
Here’s my version, that I believe it’s really better:
add_action('admin_init', 'rw_remove_dashboard_widgets');
function rw_remove_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // recent comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // incoming links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'normal'); // quick press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal'); // recent drafts
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // wordpress blog
remove_meta_box('dashboard_secondary', 'dashboard', 'normal'); // other wordpress news
}
To use it, just put it in functions.php of your theme. If you want to keep some widgets, just comment out corresponding lines.




I agree,
I also use the same way to remove any metaboxes from the post, page and links page editors.
Excellent tip thanks!
I also agree.. much easier. Thanks for the post.
Thanks for this tip. Now, I can hide unwanted wordpress links from dashboard.
THANK YOU! I’ve been looking how to remove the ‘WordPress news’ and ‘WordPress blogs’ from my Screen Options, all night!
Finally found this posting and it works like a charm!
Three thumbs up! (don’t ask)
Would it be possible to put this in a plugin rather than functions.php, so it can be network activated across a multisite network?
Thanks for dragging out me before become crazy :D
T . O . P