If what you want to do is to hide the menu items you can make use of remove_menu_page
and remove_submenu_page
by hooking into admin_menu
.
In order to hide certain links based on the user’s role (in your case, Editor):
function custom_remove_menus(){
// Get current user's data
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
// Check user's roles
$user = new WP_User( $user_id );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( 'editor', $user->roles ) ) {
// Remove menu items
remove_menu_page( 'edit.php?post_type=news' );
remove_submenu_page( 'edit.php?post_type=news', 'post-new.php?post_type=news');
}
}
}
add_action( 'admin_menu', 'custom_remove_menus' );
You can hover over the menus to see what the link is.
However, as noted in the Codex
Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user’s permissions as appropriate.