I want to get all the menu items in the admin menu in the backend. To be clear, the menu which is generated from /wp-admin/menu-header.php.

How can I do this, I see that plugins for instance Adminimize does the same, but I have a hard time finding out exactly how.

Thanks in advance.


Menu and submenu data is accessible through the $menu and $submenu globals:

add_action( 'admin_notices', 'so19890599_print_menus' );
function so19890599_print_menus()
    global $menu, $submenu;

    echo '<pre>'; print_r( $menu ); echo '</pre>';
    echo '<pre>'; print_r( $submenu ); echo '</pre>';

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.