WordPress

Remove WordPress Dashboard Widgets

On the WordPress dashboard you get to see lots of information about your current WordPress site. You get things like:

Wordpress Dashboard

  • Recent Comments
  • Incoming Links
  • New Plugins
  • Drafts
  • WordPress News

You can even add your even widgets to the dashboard, there is a good plugin that creates a widget with your Google analytics report on your dashboard.

But things like analytics you might not want to show to everyone who can login to the dashboard, so you will need to remove certain widgets.

To remove widgets from the dashboard you can use the following snippet and add it to your functions.php.

function disable_dashboard_widgets() {  
  
    remove_meta_box('dashboard_right_now', 'dashboard', 'core');  
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');  
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');  
    remove_meta_box('dashboard_plugins', 'dashboard', 'core');  
    remove_meta_box('dashboard_quick_press', 'dashboard', 'core');  
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');  
}  
add_action('wp_dashboard_setup', 'disable_dashboard_widgets');

This snippet will disable all the widgets on your dashboard, but you can just pick ones you want to hide.

But you might just want to hide these for certain users, such as if the user isn't the admin then hide these widget.

Copy the following snippet to disable all widget if the user isn't the admin user.

function disable_dashboard_widgets() {  
    global $current_user;  
    get_currentuserinfo();

    if($current_user->user_level != 1){
        remove_meta_box('dashboard_right_now', 'dashboard', 'core');  
        remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');  
        remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');  
        remove_meta_box('dashboard_plugins', 'dashboard', 'core');  
        remove_meta_box('dashboard_quick_press', 'dashboard', 'core');  
        remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');  
    }
}  
add_action('wp_dashboard_setup', 'disable_dashboard_widgets');

WordPress Welcome Panel

If you would like to remove the welcome panel in the admin area, you can use the WordPress action welcome_panel.

remove_action('welcome_panel', 'wp_welcome_panel');

Dashboard Activity

In WordPress 3.8 a new meta box was added for the dashboard activity to remove this meta box you need to use the following code.

remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

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