How to Add and Remove WP Admin Bar Links

WordPress 3.1 introduced a new feature, the WP Admin Bar.

Here’s how to customise it by removing existing links and adding new links.

The WP Admin Bar

The new Admin Bar appeared in the v3.1 release of WordPress many developers were quick to disable it completely.

True, it could have been turned off by default allowing the feature to be discovered.  This may have stopped the “Woah – what is that thing at the top of my website and how can I get rid of it?” attitude.

It’s only now that developers are starting to play with the features it offers, customising it to their website needs.

Our WP Admin Bar with a “Customer Home” link for our clients

Customizing The WP Admin Bar

Modifying the WP Admin Bar works by adding a function and hook to your theme’s functions.php file.  Here’e the basic code.

// Admin Bar Customisation
function mytheme_admin_bar_render() {
global $wp_admin_bar;

// Remove an existing link using its $id
// Here we remove the 'Updates' drop-down link

// Add a new top level menu link
// Here we add a customer support URL link
$customerSupportURL = '';
$wp_admin_bar->add_menu( array(
'parent' => false,
'id' => 'customer_support',
'title' => __('Customer Support'),
'href' => $customerSupportURL

// Add a new sub-menu to the link above
// Here we add a link to our contact us web page
$contactUsURL = '';
'parent' => 'customer_support',
'id' => 'contact_us',
'title' => __('Contact Us'),
'href' => $contactUsURL

// Finally we add our hook function
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );

WP Admin Bar Default Link IDs

The WP Admin Bar default link IDs can be found in the /wp-includes/admin-bar.php file.  Here’s a summary of those link IDs:

  • my-account – the link to your account (if you haven’t enabled avatars)
  • my-account-with-avatar – the link to your account (if avatars are enabled)
  • my-blogs – the ‘My Sites’ menu if the user has more than one site
  • get-shortlink – provides a Shortlink to that page
  • edit – link to Edit [content-type]
  • new-content – the ‘Add New’ drop-down menu link
  • comments – the ‘Comments’ drop-down menu link
  • appearance – the ‘Appearance’ drop-down menu link
  • updates – the ‘Updates’ drop-down menu link

Using the WP Admin Bar

We have recently introduced a client area where our customers can log in and get their own relevant project information.

Each customer has a “home page” which is specified on the users profile and we have added a “Customer Home” link to the WP Admin Bar that always takes them to their specific homepage, wherever they may be in our site.

How have you customised yours?

Take a screenshot of your WP Admin Bar customizations and send them in to us.  We’ll publish the best ones along with a link to the website on our Facebook Page.

Was this article helpful?

Keep In Touch


Wil is a dad, WordPress consultant, WordPress developer, business coach and mentor. He co-organizes the WordPress Sydney meetup group and has been on the organising committee for WordCamp Sydney since 2014. He speaks at many special events and contributes to the WordPress open source project. His likes are chillies, craft beer and electrogravitics.