Skip to content

Instantly share code, notes, and snippets.

@anythinggraphic
Last active February 27, 2021 21:40
Show Gist options
  • Save anythinggraphic/aff10a6dbe0f26c57817b12cb9a0c811 to your computer and use it in GitHub Desktop.
Save anythinggraphic/aff10a6dbe0f26c57817b12cb9a0c811 to your computer and use it in GitHub Desktop.
Remove widgets on the WP Admion Dashboard page.
<?php
/**
* Remove widgets on the WP Admion Dashboard page.
*
* @see https://digwp.com/2014/02/disable-default-dashboard-widgets/
* @see https://anythinggraphic.net
* @since 1.0.0
*/
function anythinggraphic_unset_dashboard_widgets() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity'] ); // Activity.
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] ); // At A Glance.
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] ); // Recent Comments.
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] ); // Incoming Links.
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] ); // Plugins.
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] ); // WordPress Events and News.
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] ); // Quick Draft.
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts'] ); // Recent Drafts.
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_site_health'] ); // Site Health Status.
// unset( $wp_meta_boxes['dashboard']['normal']['core']['yoast_db_widget'] ); // Yoast SEO.
// unset( $wp_meta_boxes['dashboard']['normal']['core']['rg_forms_dashboard'] ); // Gravity Forms.
// unset( $wp_meta_boxes['dashboard']['normal']['core']['wpforms_reports_widget_lite'] ); // WPForms.
}
add_action( 'wp_dashboard_setup', 'unset_dashboard_widgets', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment