How to Remove Core WordPress Dashboard Widgets and create Custom Widgets

For advanced WordPress developers, you might want to leverage the in-built dashboard capability to supercharge your theme or plugin.

Remove the default widgets, and create a custom widget.

First to clean it up, we will remove the core dashboard widgets.

/* REMOVE CORE WIDGETS */
add_action('wp_dashboard_setup', function() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']);
});

Then, afterwards you can create your own custom widget.

/* CUSTOM DASHBOARD WIDGET */
add_action('wp_dashboard_setup', 'MyCustomDashboardWidget1');

function MyCustomDashboardWidget1() {
global $wp_meta_boxes;
wp_add_dashboard_widget('custom_widget1_title', 'Custom Widget Display Title', 'MyCustomDashboardWidget1Content');

}

function MyCustomDashboardWidget1Content() {
echo "Content here";
}

    Hey, smarty!

    Login or signup to get started

    What's your name?

    What's your password? Lost Password
    We sent a link to reset your password to your email.
    Create a new password
    Upload file