Created
September 17, 2012 05:31
-
-
Save joshualynch/3735711 to your computer and use it in GitHub Desktop.
Replace WordPress "My Sites" Menu for Super Admins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Disable My Sites menu in toolbar for Super Admins & replace with custom menu | |
* Docs: http://codex.wordpress.org/Class_Reference/WP_Admin_Bar | |
*/ | |
function jpl_remove_my_sites( $wp_admin_bar ) { | |
if (current_user_can('manage_network')) | |
$wp_admin_bar->remove_node('my-sites'); | |
} | |
add_action( 'admin_bar_menu', 'jpl_remove_my_sites', 999 ); | |
function jpl_my_sites($admin_bar) { | |
if (current_user_can('manage_network')) | |
$admin_bar->add_menu( array( | |
'id' => 'jpl-my-sites', | |
'title' => 'My Sites', | |
'href' => admin_url('my-sites.php'), | |
'meta' => array( | |
'title' => __('My Sites'), | |
), | |
)); | |
$admin_bar->add_menu( array( | |
'id' => 'jpl-network-admin', | |
'parent' => 'jpl-my-sites', | |
'title' => 'Network Dashboard', | |
'href' => network_admin_url(), | |
)); | |
$admin_bar->add_menu( array( | |
'id' => 'jpl-network-sites', | |
'parent' => 'jpl-my-sites', | |
'title' => 'Network Sites', | |
'href' => network_admin_url('sites.php'), | |
)); | |
$admin_bar->add_menu( array( | |
'id' => 'jpl-network-users', | |
'parent' => 'jpl-my-sites', | |
'title' => 'Network Users', | |
'href' => network_admin_url('users.php'), | |
)); | |
} | |
add_action('admin_bar_menu', 'jpl_my_sites', 20); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment