Skip to content

Instantly share code, notes, and snippets.

@erikccoder
Created May 10, 2013 04:46
Show Gist options
  • Save erikccoder/5552436 to your computer and use it in GitHub Desktop.
Save erikccoder/5552436 to your computer and use it in GitHub Desktop.
wordpress remove backend admin bar
// remove admin bar at backend
//plugin: http://wordpress.org/extend/plugins/wp-admin-bar-removal/
add_action( 'admin_bar_menu', 'wpse_76491_admin_bar_menu', 200 );
function wpse_76491_admin_bar_menu()
{
global $wp_admin_bar;
if ( !is_object( $wp_admin_bar ) )
return;
// Clean the AdminBar
$nodes = $wp_admin_bar->get_nodes();
foreach( $nodes as $node )
{
// 'top-secondary' is used for the User Actions right side menu
if( !$node->parent || 'top-secondary' == $node->parent )
{
$wp_admin_bar->remove_menu( $node->id );
}
}
// end Clean
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment