Hide certain post types from editors

Here a little function which takes care to hide (In admin) Custom Post Types.

function remove_from_admin_menu(){
    // Check capability (admin)
    if( current_user_can( 'edit_dashboard' )){
        //Do nothing
    } elseif ( current_user_can( 'moderate_comments' ) ) { // editor capability
        remove_menu_page( 'edit.php?post_type=cpt01' ); // add here your cpt name
        remove_menu_page( 'edit.php?post_type=cpt02' );             
        remove_menu_page( 'edit.php?post_type=cpt03' );
        // for submenu pages
        remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'testimonialswidget_settings' ); 

    }
}
add_action('admin_menu', 'remove_from_admin_menu');

FYI:
About roles/capabilities see codex.
Remove menu page. (Codex)
Remove sub-menu page.(Codex)
Credits to michael-cannon for his sub-menu cpt sample.(Github)

To do the same kind of trick for categories you could take a look here because it is unclear to me if that is what you realy want to do that way. If yes, then the credits should go to him and not to me 🙂