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!
Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!