How can I change a submenu-item in the WordPress-dashboard to a mainmenu-item?

I want to create a custom WordPress-dashboard for one of my cliënts. Now I want to hide the “appearance”-menu in the dashboard, but I want the submenu “Menus” to be visible as a mainmenu-item.

The “appearance”-menu is normally automaticly hidden since the client’s profile has an editor-role. So I bring the “appearance” menu back for editors like this:

Read More
// get the the role object
$role_object = get_role( 'editor' );
// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );

I can hide the other submenu-items with CSS, but then I still got the “appearance”-menu and I don’t want the cliënt to change the theme.

Is there any solution to make the submenu “Menus” visible as a mainmenu-item?

Related posts

1 comment

  1. At first you have to remove the submenu and then add it again. The code should look something like this:

    add_action( 'admin_menu', 'register_my_custom_menu_page' );
    
    function register_my_custom_menu_page( ) {
        remove_submenu_page( 'themes.php','nav-menus.php') ; 
        add_menu_page( 'Menus', 'menu', 'manage_options', 'nav-menus.php' );
    }
    

    See the WordPress Codex

Comments are closed.