How to Add an Admin Bar Menu Link

add-wordpress-admin-bar-menu-link

Here is an example code how to add Editorial Calendar plugin admin bar menu link:

function add_editorial_calendar_admin_bar_link() {
	global $wp_admin_bar;
	if (!is_super_admin() || !is_admin_bar_showing())
		return;
	$wp_admin_bar->add_menu(array(
		'id' => 'editorial_calendar_link',
		'title' => __('Editorial Calendar'),
		'href' => __('http://' . strtolower($_SERVER['HTTP_HOST']) . '/wp-admin/edit.php?page=cal'),
	) );
}
add_action('admin_bar_menu', 'add_editorial_calendar_admin_bar_link', 75);

Leave a Comment

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

Scroll to Top