Disable default WordPress dashboard widgets
When we login in to WordPress dashboard, the WordPress display few dashboard widgets. In almost WordPress installations, some of these widgets don’t have any role in daily operations from the view a normal WordPress user.
So, when I deliver WordPress site for my clients, I like to hide these unnecessary widgets from there dashboard. We can simply hide them using screen options at the top of page.
But if you like to programmatically hide them from your theme, just use below codes in your theme’s or child theme’s functions.php
file.
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
//Uncomment line to hide dashboard widget
//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']);
}
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets', 999);
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- Automating Code Linting with GitHub Actions for WordPress Plugins
- Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
- The Ultimate Guide to Indexing in Database Design
- Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
- A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.