Hide Dashboard menu items for specific user

To do a “dirty” quick remove Dashboard menu can save you a lot of time, if you have a custom post type that user should only have access to.

In functions.php add the following to remove menu items for the user group Editor:

/* hide Dashboard menu items for user: editor */
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
    global $user_ID;
    if ( current_user_can( 'editor' ) ) {
    remove_menu_page('edit.php'); // Posts
    remove_menu_page('upload.php'); // Media
    remove_menu_page('link-manager.php'); // Links
    remove_menu_page('edit-comments.php'); // Comments
    remove_menu_page('edit.php?post_type=page'); // Pages
    remove_menu_page('plugins.php'); // Plugins
    remove_menu_page('themes.php'); // Appearance
    remove_menu_page('users.php'); // Users
    remove_menu_page('tools.php'); // Tools
    remove_menu_page('options-general.php'); // Settings
    }
}

Reference

More:

Leave a Reply

Your email address will not be published. Required fields are marked *