Hide "My Sites" From Regular Users
Removes the My Sites menu from the toolbar for everyone except super admins, so members of several sites are not distracted by the network structure.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_action( 'admin_bar_menu', function ( $bar ) {
if ( ! is_super_admin() ) {
$bar->remove_node( 'my-sites' );
}
}, 999 );
Notes
Users can still reach their other sites by address.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.