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? – Arsalan Mithani Jan 29 '17 at 20:08

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


| improve this answer | |
  • I really searched about it and found this reply but i don't want to show all this stuff " themes , customize , widget menus " – Mohamed Yasin Jan 29 '17 at 20:17
  • I need the code to let the editor control the menus only – Mohamed Yasin Jan 29 '17 at 20:18
  • I changed the code, try this now – Arsalan Mithani Jan 29 '17 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. – Mark Kaplun Jan 29 '17 at 20:56
  • @mark i will test and add an update, but do you have any alternate solution so i can add it too? – Arsalan Mithani Jan 29 '17 at 22:07

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.