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?
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?
Share Improve this question asked May 22, 2019 at 6:26 TahtuTahtu 1173 bronze badges1 Answer
Reset to default 0Try 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'),
),
));
}