Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
Created December 12, 2013 00:40
Show Gist options
  • Save bryanwillis/7921310 to your computer and use it in GitHub Desktop.
Save bryanwillis/7921310 to your computer and use it in GitHub Desktop.
Different ways to remove wp dashboard widgets. I think disable_dash.php is considered the best method.
//* REMOVE DASHBOARD WELCOME
remove_action('welcome_panel', 'wp_welcome_panel');
// */
//* REMOVE ADMIN DASHBOARD WIDGETS
// Create the function to use in the action hook
function remove_default_dashboard_widgets() {
// Main column:
remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
// Side Column:
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
}
// Hook into the 'wp_dashboard_setup' action to register our function
add_action('wp_dashboard_setup', 'remove_default_dashboard_widgets' );
// */
/* Disable WordPress dashboard widgets
function remove_default_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');
}
// USES ADMIN MENU --- NOT SURE WHY MAYBE OLD?
add_action('admin_menu', 'disable_default_dashboard_widgets');
// */
/* UNSET WordPress dashboard widgets
function remove_dashboard_widgets(){
global$wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
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']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
// */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment