How to let the role "editor" to control the menu the only code i found was

$role_object = get_role( 'editor' );

but i couldn't use it

  • 1
    "but i couldn't use it" - what do you mean? Commented Jan 29, 2017 at 20:08

1 Answer 1


Add this to your functions.php

// Allow editors to see Appearance menu
$role_object = get_role( 'editor' );
$role_object->add_cap( 'edit_theme_options' );
function hide_menu() {
    // Hide theme selection page
    remove_submenu_page( 'themes.php', 'themes.php' );
    // Hide widgets page
    remove_submenu_page( 'themes.php', 'widgets.php' );
    // Hide customize page
    global $submenu;
add_action('admin_head', 'hide_menu');


  • I really searched about it and found this reply but i don't want to show all this stuff " themes , customize , widget menus " Commented Jan 29, 2017 at 20:17
  • I need the code to let the editor control the menus only Commented Jan 29, 2017 at 20:18
  • I changed the code, try this now Commented Jan 29, 2017 at 20:23
  • roles are for more than menu display. enabling such a permission to someone which is not an admin, should not be done just to be able to have some more stuff in the menu. For example removing the widgets from the menu will not prevent the user from modifying them via the customizer. Commented Jan 29, 2017 at 20:56
  • @mark i will test and add an update, but do you have any alternate solution so i can add it too? Commented Jan 29, 2017 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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