2011-02-26

by Alex Chousmith
in Admin area

Add/Remove Admin Bar Links

Code:

Instructions:

The WP Admin Bar is new in 3.1. Here is a basic function and hook you can use in your theme’s functions.php file to Add a new link to the WP Admin Bar, and Remove an existing link.

Here are some IDs for the default links WP 3.1 adds, found in /wp-includes/admin-bar.php:

my-account / my-account-with-avatar : the first link, to your account. Note that the ID here changes depending on if you have Avatars enabled or not.
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’ dropdown
comments : the ‘Comments’ dropdown
appearance : the ‘Appearance’ dropdown
updates : the ‘Updates’ dropdown