Skip to content

Instantly share code, notes, and snippets.

@natenault
Created January 18, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natenault/17c6affc091d6a5a0cc8c6fc59732068 to your computer and use it in GitHub Desktop.
Save natenault/17c6affc091d6a5a0cc8c6fc59732068 to your computer and use it in GitHub Desktop.
Remove default WordPress dashboard widgets
/**
* Remove default WordPress dashboard widgets
*/
function nn_remove_dashboard_meta_boxes() {
global $wp_meta_boxes;
// WordPress
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] );
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']['side']['core']['dashboard_recent_drafts'] );
/**
* Remove Yoast SEO dashboard widget
* Last Tested: Jun 16 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
if ( defined( 'WPSEO_VERSION' ) ) {
// May need to replace 'side' with 'normal' or 'advanced' in some cases.
remove_meta_box( 'wpseo-dashboard-overview', 'dashboard', 'side' );
}
}
add_action( 'wp_dashboard_setup', 'nn_remove_dashboard_meta_boxes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment