Skip to content

Instantly share code, notes, and snippets.

@DWboutin
Created September 9, 2013 20:06
Show Gist options
  • Save DWboutin/6500780 to your computer and use it in GitHub Desktop.
Save DWboutin/6500780 to your computer and use it in GitHub Desktop.
Add and remove menus in the admin bar (wordpress)
function mytheme_admin_bar_render() {
global $wp_admin_bar;
// add a menu from the admin bar
$wp_admin_bar->add_menu( array(
'id' => 'home', // link ID, defaults to a sanitized title value
'title' => __('Home'), // link title
'href' => admin_url( '../index.php'), // name of file
'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
));
// remove a menu from the admin bar
$wp_admin_bar->remove_menu('new-content');
}
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