skip to Main Content

Adding and Removing WordPress Admin Bar Items

For freelancers, progammers and designers, we always would want that our site turn-overs be smooth.  Especially with wordpress websites.  Though our clients have access to an admin account, we let them use an account with minimized menus and navigation to lessen the possibility of the client messing up with templates and/or plugins let alone with wordpress core files.

For simplicity in Adding and Removing WordPress Admin Bar Items, here are two basic functions (yes functions that we can insert into our client’s function.php file in within their template).

1) This one removes items from the admin bar, we have programmed ours to remove certain items should certain usernames be used to log in.

add_action( 'admin_bar_menu', 'remove_admin_bar_items', 999 );
function remove_admin_bar_items( $wp_admin_bar )
$current_user = wp_get_current_user();
if (($loggedinuser=="admin") || ($loggedinuser=="marketing") || ($loggedinuser=="mis"))
$wp_admin_bar->remove_node( 'wp-logo' );
$wp_admin_bar->remove_node( 'comments' );
$wp_admin_bar->remove_node( 'new-etn_menu' );

$wp_admin_bar->remove_node( ‘wp-logo’ );
$wp_admin_bar->remove_node( ‘comments’ );
$wp_admin_bar->remove_node( ‘new-content’ );



2) This one adds items to the admin bar, specifically under the “Howdy” portion.

add_action('admin_bar_menu', 'add_items',  100);
function add_items($admin_bar)
   $args = array(
   'id'    => 'my-item',
   'title' => 'Support',
   'href'  => '',
   'parent' => 'user-actions',
   'meta'  => array('title' => __('Support  @ ETN Multimedia'),'target' =>__('_blank'))
   $admin_bar->add_menu( $args);

resource :

Back To Top