How to: Remove dashboard widgets in WordPress

We used to see lots of widgets on WordPress’s dashboard. By default there is an option called “Screen Option“, to hide them all. But how can we remove or disable them forever?. Here is the simple script for you. This script will remove dashboard widgets in WordPress.

Open your theme’s functions.php file located in your theme’s folder. Copy this script, paste it in your theme’s function.php file and save it. Now got the dashboard page. Wow, everything is gone. Right?.

function remove_dashboard_widgets() {
  global $wp_meta_boxes;

  // For right now information widget
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);

  // For recent comments listing widget
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);

  // For quick press widget
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);

  // For recent drafts widget
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);

  // For Plugin information widget
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);

  // For incoming links information widget
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);

  // For WordPress blog news widget
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);

  // For other WordPress news widget
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);

}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );

This script was successfully tested in WordPress 3.2.1. if you like to know more about WordPress dashboard widgets check out WP Codex now.

About