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

Jake Bresnehan

A Front End Developer based in Sydney and the creator of Web Design Weekly.

Web Design Weekly keeps developers at the forefront of techniques and trends whilst helping them learn and grow to produce top quality code to make the web a better place for all.

This post currently has no responses. 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 *

Current day month ye@r *