add to functions.php
function create_Stephen_menu() { global $wp_admin_bar; $menu_id = 'Stephen'; $wp_admin_bar->add_menu(array('id' => $menu_id, 'title' => __('Stephen'), 'href' => '/')); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'title' => __('Homepage'), 'id' => 'Stephen-home', 'href' => '/', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'title' => __('Drafts'), 'id' => 'Stephen-drafts', 'href' => 'edit.php?post_status=draft&post_type=post')); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'title' => __('Pending Comments'), 'id' => 'Stephen-pending', 'href' => 'edit-comments.php?comment_status=moderated')); } add_action('admin_bar_menu', 'create_Stephen_menu', 2000);
Setting an id on parent menu item allows parent key for submenu items
https://davidwalsh.name/add-submenu-wordpress-admin-bar By David Walsh on January 6, 2015