12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Apr 21, 2020

How to add a custom link under site name menu in the WP admin toolbar

Sridhar Katakam

Looking to add a custom menu item in the Toolbar under <Home icon> <Site Name>?

Just add the following in a Code Snippet and modify as needed:

add_action( 'wp_before_admin_bar_render', 'wpdd_admin_bar_edit' );
/**
 * Add a new item under the (Home icon) site name in the toolbar on the backend.
 */
function wpdd_admin_bar_edit() {
	global $wp_admin_bar;

	$wp_admin_bar->add_menu( array(
		'parent' => 'site-name', // site-name is the ID for home menu so we use it as the parent ID.
		'id' => 'customer_support', // You can add any value here as you are adding something very new here.
		'title' => __( 'Customer Support' ), // The anchor text.
		'href' => 'https://www.paypal.me/sridharkatakam/120usd', // URL to link to. Don't change this. Just kidding.
	));
}

Reference

https://onextrapixel.com/taking-control-of-wordpress-3-0-admin-bar/ via google search.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right