Adding Toolbar Menus in WordPress

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

Want to become a better web developer?

Join over 25,000 other developer & designers who get awesome links to the best news and articles each week delivered directly to their inbox.

1 Comment

  1. Very informative blog post.Much thanks again. Great.

This post currently has one response. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *