Sarmad Gardezi

Sarmad Gardezi

a freelance developer

Remove all WordPress Widgets in Admin Dashboard

Hello im Sarmad gardezi and im going to tell you that how you can remove all widgets from your WordPress Dashboard. When you login to your WordPress website admin dashboard, you will notice several widgets such as Activity Stream, WordPress News, Quick Draft and few others widgets based on user role.

Most of the time in wordpress dashboard we find these widgets very useful but some time they are so annoying or we want to prevent other website members to see them, So we need to hide them. If you want to remove them, then this little hack will help you. You can remove those widgets either by using  our Smart Dashboard Extras WordPress Plugin or you can directly use the php code snippet.

 

 

Using Smart Dashboard Extras WordPress Plugin

You may install the plugin directly via the built-in WordPress plugin installer or using FTP method. If you use FTP method, you first need to download Plugin form WordPress plugin directory.

  1. Once downloaded, Unzip st-smart-dashboard-extras.zip inside the /wp-content/plugins/directory for your site
  2. Activate the plugin through the \’Plugins\’ admin menu in WordPress
  3. Click on the “Smart Dashboard Extra” menu item in your WordPress dashboard to customize the plugin settings.
  4. Select “Remove all WordPress Dashboard Widgets” from Dashboard Customisation settings tab and click “Save Changes” button.

Remove all WordPress Widgets for non Admin

Or if you’re familiar with php code, you can directly add the following code snippets to your functions.php file.


//Remove Dashboard Metabox Widgets for all users except Admin
add_action('wp_dashboard_setup', 'stsd_remove_dashboard_widget' );
function stsd_remove_dashboard_widget() {
if (!current_user_can('manage_options')){
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
}
}

The above code snippet, removes all of the default WordPress widgets for users other then administrators. It will eb very small in size and doesnt effect on page load on website space if your using some small hosting plan.


Subscribe to Newsletters