Is it possible to remove all references to 'edit' or 'add' from a particular post type on its post list display screen in admin?
So basically what I need is that for this post type, all roles defined, whatever they are, can only view a list of these posts, and not do anything with them except trash them. So that means removing the 'Add New myposttype' button, as well as the 'Edit | Quick Edit' links beneath each entry of the list posts screen.
In my custom post type these are my capability related settings:
'capability_type' => array('food_item','food_items'), 'map_meta_cap' => true, 'capabilities' => array( 'publish_posts' => 'publish_food_items', 'edit_posts' => 'edit_food_items', 'edit_others_posts' => 'edit_others_food_items', 'delete_posts' => 'delete_food_items', 'delete_others_posts' => 'delete_others_food_items', 'read_private_posts' => 'read_private_food_items', 'edit_post' => 'edit_food_item', 'delete_post' => 'delete_food_item', 'read_post' => 'read_food_item'
In my plugin init function, I'm adding the following:
global $wp_roles; $wp_roles->add_cap( 'administrator', 'edit_food_item' ); $wp_roles->add_cap( 'administrator', 'edit_food_items' );
At this point the administrator just cannot see the food items entry in the menu at all.