0

How do I hide "Pages", "Media", "Comments"....for editor role?

enter image description here

1

1 Answer 1

3
/** remove editor dashboard menu
*/ define( 'DISALLOW_FILE_EDIT', true);
 
function remove_menus(){

  remove_menu_page( 'index.php' );                  //Dashboard  
  remove_menu_page( 'jetpack' );                    //Jetpack*   //
  remove_menu_page( 'edit.php' );                   //Posts  
  remove_menu_page( 'upload.php' );                 //Media  
  remove_menu_page( 'edit.php?post_type=page' );    //Pages  
  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
  remove_menu_page( 'wpcf7' );        //contact form

}

if ( current_user_can( 'editor' ) ){
    add_action( 'admin_menu', 'remove_menus' );
}

I found the solution, add these in theme function.php

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.