Remove Dashboard Widgets In WordPress - The Better Way

Remove Dashboard Widgets In WordPress – The Better Way

Remove Dashboard Widgets In WordPress - The Better Way

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

 // Remove the incoming links widget

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.


  1. I agree,

    I also use the same way to remove any metaboxes from the post, page and links page editors.

  2. 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)

  3. Would it be possible to put this in a plugin rather than functions.php, so it can be network activated across a multisite network?

    1. Better late than never, you can either put this in “/wp-content/plugins/nameyouprefer.php” and network activate it as a plugin, or put it into “/wp-content/mu-plugins/nameyouprefer.php” and it will always run as it’s a “must-us plugin”.

  4. Hi! Just tried it! It works like a dream on all user profiles unlike the codex unset implementation which only seemed to work on the admin profile. Great code! Thank you very much! Zephyr

  5. Thanks for this great tip.

    I was searching all over for an easy method.

    When I applied yours, it worked first time:-)

Comments are closed.