Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For the editor I would just like to display Pages, Posts, Media and Menus. Is there a way of doing this with the functions file or similar?

Thanks in advance.

share|improve this question

2 Answers 2

If you just want to remove the menu options, you can use the remove_menu_page function in your functions.php file

remove_menu_page

Add this code to functions.php:

    function remove_menus(){
       remove_menu_page( 'index.php' );                  //Dashboard
       remove_menu_page( 'edit-comments.php' );          //Comments
       remove_menu_page( 'themes.php' );                 //Appearance
       remove_menu_page( 'plugins.php' );                //Plugins
       remove_menu_page( 'users.php' );                  //Users
       remove_menu_page( 'tools.php' );                  //Tools
       remove_menu_page( 'options-general.php' );        //Settings
   }

   add_action( 'admin_menu', 'remove_menus' );

That should remove everything except the options you want to keep.

If you want to remove the menu options for editors only, use an if statement within the function:

function remove_menus(){
    if(current_user_can('editor')){
        remove_menu_page( 'index.php' );                  //Dashboard
        remove_menu_page( 'edit-comments.php' );          //Comments
        remove_menu_page( 'themes.php' );                 //Appearance
        remove_menu_page( 'plugins.php' );                //Plugins
        remove_menu_page( 'users.php' );                  //Users
        remove_menu_page( 'tools.php' );                  //Tools
        remove_menu_page( 'options-general.php' );        //Settings
    }
}

add_action( 'admin_menu', 'remove_menus' );
share|improve this answer
    
Can this be done on a per user basis? For just the Editors for example? –  Josh Mar 18 at 17:07
    
Yes, you should be able to remove the menu options for only certain user roles by using an if statement within the remove_menus function. See updated answer. –  Sean Henderson Mar 18 at 17:22
    
What about the other way around, what if Pages, Posts, Media and Menus are the only ones I want to display? Can I do it that way? –  Josh Mar 18 at 17:40
    
Do you want to remove those menu options? The code above is to remove menu options, so that a user logged in as an editor should only see the menu options: Pages, Posts, Media and Menus. The other menu options listed in the code will be removed. –  Sean Henderson Mar 18 at 17:47
    
That's great, the only thing is that the 'nav-menus.php' page is what I was hoping to have on the sidebar as well! That was why I queried adding specific menu items instead of removing them! Thanks for your help! –  Josh Mar 18 at 18:03

Are you trying to manage the contents of the admin menu? If so, perhaps this plugin would help: Admin Menu Editor

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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