Add Links to WordPress 3.3 Multisite Toolbar
-
I need to add a link to the toolbar to be used by the Super Admin of a Multisite setup managing several sites.
The link I need to add to the toolbar is simply a shortcut to the same menu item in each specific admin area. The problem is, when I add a link to the toolbar within the admin area of one site, and then enter the admin area of a second site – clicking the link on the toolbar of the second site takes me back to the admin area of the first.
I have found the following script that will add a link in a non-WPMS environment, for a link with 2 sub-menus:
<?php add_action('admin_bar_menu', 'add_toolbar_items', 100); function add_toolbar_items($admin_bar){ $admin_bar->add_menu( array( 'id' => 'my-item', 'title' => 'My Item', 'href' => '#', 'meta' => array( 'title' => __('My Item'), ), )); $admin_bar->add_menu( array( 'id' => 'my-sub-item', 'parent' => 'my-item', 'title' => 'My Sub Menu Item', 'href' => '#', 'meta' => array( 'title' => __('My Sub Menu Item'), 'target' => '_blank', 'class' => 'my_menu_item_class' ), )); $admin_bar->add_menu( array( 'id' => 'my-second-sub-item', 'parent' => 'my-item', 'title' => 'My Second Sub Menu Item', 'href' => '#', 'meta' => array( 'title' => __('My Second Sub Menu Item'), 'target' => '_blank', 'class' => 'my_menu_item_class' ), )); } ?>
Is there any way this script can realise which multisite I am in, and take me to the menu item within the correct admin area? Any help would be much appreciated!
- The topic ‘Add Links to WordPress 3.3 Multisite Toolbar’ is closed to new replies.