Custom Links in WordPress Admin Bar June 11th, 2014

Add to the theme’s functions.php file…

function admin_bar_custom_links(){
    global $wp_admin_bar;
    if(!is_super_admin() || !is_admin_bar_showing()){
        return;
    }
    $wp_admin_bar->add_menu(array(
        'id'    => 'all_posts',
        'title' => __('All Posts'),
        'href'  => __('http://webninjataylor.com/library/wp-admin/edit.php'),
    ));
    // Add sub menu link
    $wp_admin_bar->add_menu( array(
        'parent'    => 'all_posts',
        'id'        => 'all_pages',
        'title'     => __( 'All Pages'),
        'href'      => __('http://webninjataylor.com/library/wp-admin/edit.php?post_type=page'),
    ));
}
add_action('admin_bar_menu','admin_bar_custom_links',25);

Change parent, id, title, and href

Resources