In the past we have move and removed items from the “WordPress admin bar”. With the release of WordPress 3.3, code name Sonny, we no longer feel we need to modify the bar. Its solid implementation does exactly what we are looking for now, however, we wanted to save and mention the code that was used to remove items from the bar.
In this example we are going to remove the my-account and comments sections of the admin bar, but only for users below “super_admin”. Whats super admin? That’s a multisite administrator that has control over all the sites in multisite.
[code]function remove_admin_bar_links() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() ) return;
$wp_admin_bar->remove_menu(‘comments’);
$wp_admin_bar->remove_menu(‘my-account’);
}
add_action( ‘wp_before_admin_bar_render’, ‘remove_admin_bar_links’ );[/code]
© Copyright 2023 Sethmatics Websites All Rights Reserved.