Created
July 29, 2013 17:35
-
-
Save trevorgreenleaf/6106038 to your computer and use it in GitHub Desktop.
Remove menu items from wordpress menues
This file contains 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 | |
function mytheme_admin_bar_render() { | |
global $wp_admin_bar; | |
// we can remove a menu item, like the Comments link, just by knowing the right $id | |
$wp_admin_bar->remove_menu('comments'); | |
// or we can remove a submenu, like New Link. | |
$wp_admin_bar->remove_menu('new-link', 'new-content'); | |
// we can add a submenu item too | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'new-content', | |
'id' => 'new_media', | |
'title' => __('Media'), | |
'href' => admin_url( 'media-new.php') | |
) ); | |
} | |
// and we hook our function via | |
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment