Created
January 18, 2018 09:18
-
-
Save natenault/17c6affc091d6a5a0cc8c6fc59732068 to your computer and use it in GitHub Desktop.
Remove default WordPress dashboard widgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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