Add Custom Info Widget to WordPress Admin Dashboard [code snippet]


Add Custom Info Widget to WordPress Admin Dashboard [code snippet]

The snippet below helps you customize the default WordPress admin dashboard. Sometimes the dashboard contains too much information and you want to simplify it for you or your clients. The code below will help you hide existing widgets and add a custom one. In this example I added a user guide to help new users learn how to add new content to the site.

Add code to the bottom of your themes functions.php

// disable default dashboard widgets
function disable_default_dashboard_widgets() {

    //remove_meta_box('dashboard_right_now', 'dashboard', 'core');
    remove_meta_box('dashboard_activity', 'dashboard', 'core');
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
    remove_meta_box('dashboard_plugins', 'dashboard', 'core');

    remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
    remove_meta_box('dashboard_primary', 'dashboard', 'core');
    remove_meta_box('dashboard_secondary', 'dashboard', 'core');

    remove_meta_box('dashboard_site_health', 'dashboard', 'core');
    remove_meta_box('dashboard_right_now', 'dashboard', 'core');
    remove_meta_box('wpseo-dashboard-overview', 'dashboard', 'core');
    
}
add_action('admin_menu', 'disable_default_dashboard_widgets');

// Custom dashboard box
function custom_dashboard_widget() {
    echo 'Read the user guide: <a href="/wp-content/guide.pdf" target="_blank">View Guide</a>';
}
function add_custom_dashboard_widget() {
    wp_add_dashboard_widget('custom_dashboard_widget', 'Admin User Guide', 'custom_dashboard_widget');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');

 



Written by: Jake Lett
Jake Lett is a B2B marketing consultant with over 15 years of experience in the digital marketing industry. He specializes in SEO, HubSpot, and PPC campaign management. Jake has a proven track record of helping businesses increase their online visibility and drive more traffic, leads and sales. He is a Certified Google Ads Specialist and a Certified HubSpot Developer.

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter