Adding Toolbar Menus in WordPress

November 14, 2014

If developing themes or plugins for WordPress sometimes it is handy to add a menu item to the WordPress admin bar to help quickly reference the desired action.

You can do various things with the admin bar but this snippet should help you get started.

Adding this snippet into your functions.php file you should see a new item in the WordPress admin bar.

// Add Toolbar Menus
function custom_toolbar() {
    global $wp_admin_bar;

    $args = array(
        'id'     => 'Web Design Weekly',
        'title'  => __( 'Web Design Weekly', 'text_domain' ),
        'href'   => '',
    $wp_admin_bar->add_menu( $args );


// Hook into the 'wp_before_admin_bar_render' action
add_action( 'wp_before_admin_bar_render', 'custom_toolbar', 999 );

More info can be found on the Codex page.

Join over 30,000 developers & designers who get the best news and articles delivered right to their inbox each week.