Dashboard Widgets for Multisite

Adding or removing multisite dashboard widgets is very similar to non-multisite dashboard widgets, but there are some things you should know.

/2 comments

Add Custom Dashboard Widgets for a Network

As easy as it could be 👍 If you have experience with non-multisite dashboard widgets, you already know about wp_dashboard_setup action hook. WordPress Multisite Dashboard action hook is wp_network_dashboard_setup.

Now let’s try it for a test widget.

Some notes by the below code:

add_action('wp_network_dashboard_setup', 'misha_multisite_dash_widget');
 
function misha_multisite_dash_widget(){
 
	wp_add_dashboard_widget( 'misha_1', 'Test Widget', 'misha_test_widget_2');
	add_meta_box('misha_2', 'Misha Widget', 'misha_widget_1', 'dashboard-network', 'normal', 'high' );
 
}
 
function misha_widget_1(){
	echo 'Some content for Misha Widget';
}
 
function misha_test_widget_2(){
	echo 'Some content for Test Widget';
}

And the result:

Some custom widgets we created for WordPress Network Dashboard.

Remove default ones

Before coding anything, please look at the screenshot below:

Hide network dashboard widget in Screen Options
You can hide any widgets from Network Dashboard with the Screen Options settings, which you can find in the top right part of the screen.

By default WordPress Multisite dashboard has only two default widgets – “Right now” and “WordPress Events and News”. Let’s remove both of them.

add_action('admin_init', 'misha_remove_default_ones');
 
function misha_remove_default_ones(){
	// remove Right now
	remove_meta_box( 'network_dashboard_right_now', 'dashboard-network', 'core' );
	// remove WordPress Events and News
	remove_meta_box( 'dashboard_primary', 'dashboard-network', 'side' );
 
}

Some more Multisite tips

Misha Rudrastyh

Misha Rudrastyh

I love WordPress, WooCommerce and Gutenberg so much. 10 yrs of experience.

Need some custom developer help? Let me know

Follow Misha

Need some help with WordPress Multisite?

If you need some professional developer help, I will be happy to assist you.

Contact me Who I am?

Comments — 2

Leave a comment

php js HTML CSS Code