Skip to content

Instantly share code, notes, and snippets.

@mayconmesquita
Last active January 10, 2019 02:40
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 mayconmesquita/0f6a174e84ed9734904427e655e23cad to your computer and use it in GitHub Desktop.
Save mayconmesquita/0f6a174e84ed9734904427e655e23cad to your computer and use it in GitHub Desktop.
Disable WP Dashboard Widgets (admin otimization)
<?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