Last active
January 10, 2019 02:40
-
-
Save mayconmesquita/0f6a174e84ed9734904427e655e23cad to your computer and use it in GitHub Desktop.
Disable WP Dashboard Widgets (admin otimization)
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
<?php | |
function disable_default_dashboard_widgets () { | |
global $wp_meta_boxes; | |
// wp default boxes | |
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']); | |
// bbpress | |
unset($wp_meta_boxes['dashboard']['normal']['core']['bbp-dashboard-right-now']); | |
// yoast seo | |
unset($wp_meta_boxes['dashboard']['normal']['core']['yoast_db_widget']); | |
// gravity forms | |
unset($wp_meta_boxes['dashboard']['normal']['core']['rg_forms_dashboard']); | |
// tinypng | |
unset($wp_meta_boxes['dashboard']['normal']['core']['tinypng_dashboard_widget']); | |
// wpseo-dashboard-overview | |
unset($wp_meta_boxes['dashboard']['normal']['core']['wpseo-dashboard-overview']); | |
// gadwp-widget | |
unset($wp_meta_boxes['dashboard']['normal']['core']['gadwp-widget']); | |
// wordfence_activity_report_widget | |
unset($wp_meta_boxes['dashboard']['normal']['core']['wordfence_activity_report_widget']); | |
} add_action('wp_dashboard_setup', 'disable_default_dashboard_widgets', 999999); | |
// Remove WP Welcome Panel (Dashboard widget) | |
remove_action('welcome_panel', 'wp_welcome_panel'); | |
// Remove WP Try Gutenberg (Dashboard widget) | |
remove_filter( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment