// Add Toolbar Menus function custom_toolbar() { global $wp_admin_bar; $args = array( 'id' => 'menu-1', 'title' => __( 'Toolbar Menu', 'text_domain' ), 'href' => 'http://.../', 'meta' => array( 'html' => 'html', 'class' => 'custom-toolbar-class', 'target' => '_top', 'onclick' => 'doThisJS()', 'title' => 'Toolbar Menu', 'tabindex' => '1', ), ); $wp_admin_bar->add_menu( $args ); } add_action( 'wp_before_admin_bar_render', 'custom_toolbar', 999 );