I'm not very clear how to restrict admin area post types access to specific user roles.
In my case, I have some post type such as "suppliers" which I do not want to show to "authors".
By default WP allows authors to browse, add or edit their own content. But I don't want my authors to add a "supplier" or browse entries from other admins.
I've looked into Wordpress code and the codex: http://codex.wordpress.org/Function_Reference/register_post_type
there seems to be a parameter in register_post_type( 'supplier', $args )
, which I tried to define in $args as follows, among of course other variables which I don't think I need to list here since my post type is working fine:
'capabilities' => array( 'edit_others_posts' ),
'map_meta_cap' => true,
I haven't fully understood the parameter "map_meta_cap"
- I assumed that by indicating 'edit_others_posts'
would have sufficed to bar access of 'suppliers' by simple authors (which cannot, in fact, edit other's posts). I tested this and doesn't work. Authors can still see all the "suppliers" content in the admin area and add a supplier as if it was a blog post.
How can I prevent authors (or any other specific user role or users without certain capabilities) to access and add content under specific custom post types I've created?
thank you