0

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?

0

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'),            
        ),
    ));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.