Disable and remove the default WordPress dashboard widgets and the Yoast SEO dashboard widget.
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' ); |