I want to add a page to the admin panel of wordpress. If I want to link it into the menu on the left, I can use add_menu_page. But I want to add it to the top of the admin panel. How can I do this?
1 Answer
Try this code:
add_action('admin_bar_menu', 'wp_toolbar_custom_menu', 100);
function wp_toolbar_custom_menu($admin_bar){
$admin_bar->add_menu( array(
'id' => 'menu-item',
'title' => 'Menu Item',
'href' => '#',
'meta' => array(
'title' => __('Menu Item'),
),
));
}