How to remove nodes site wide from the toolbar on multisite install
-
If you’re not on one of your sites, ie someone else’s site that you don’t administer in a WordPress Multisite install, my function below to remove nodes won’t work because it checks for current blog id.
I want to disable the dashboard link (and others) in the toolbar for each of the person in the dropdown under “My Sites” no matter who’s site they are viewing.
Is there a way to remove the node site wide? Since the remove_node is based on blog id, I’m having trouble thinking of a way to do this.
add_action( 'admin_bar_menu', 'remove_toolbar_items', 999 ); function remove_toolbar_items( $wp_admin_bar ) { $blog_id = get_current_blog_id(); // get blog id $wp_admin_bar->remove_node( 'blog-' . $blog_id . '-d' ); // Dashboard $wp_admin_bar->remove_node( 'blog-' . $blog_id . '-c' ); // Manage Comments $wp_admin_bar->remove_node( 'new-media' ); $wp_admin_bar->remove_node( 'wp-logo' ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to remove nodes site wide from the toolbar on multisite install’ is closed to new replies.