
Introduced in WordPress 3.1, the Admin bar is a new feature that many users like. Today, I’m going to show how you can add custom links to WordPress admin bar.

Introduced in WordPress 3.1, the Admin bar is a new feature that many users like. Today, I’m going to show how you can add custom links to WordPress admin bar.
To add a custom link to WordPress admin bar, simply paste the following code into your functions.php file. Modify the code as needed to fit your needs.
function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
'parent' => 'new-content', // use 'false' for a root menu, or pass the ID of the parent menu
'id' => 'new_media', // link ID, defaults to a sanitized title value
'title' => __('Media'), // link title
'href' => admin_url( 'media-new.php'), // name of file
'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
));
}
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
Thanks to Jeff Starr for the cool tip!
2 Responses
I have found a simple plugin for adding custom links to WordPress admin bar.
check this out: http://wordpress.org/extend/plugins/custom-adminbar-menus/
Thanks to author and Jose for plugin name!
Trackbacks: