I know this is an old thread, but there is still no "create_post" capability (I wonder why?) and I needed this functionality as well.
What I want: I create a single post for specific users with a custom role and then only let them edit that post.
This is what works for me:
'edit_posts' => false : will remove the ability to create posts, but also the ability to edit/update/delete
'edit_published_posts' => true : this will give back the ability to edit and update, but no to create new posts (so there will be no "Add post" button)
The whole function & hook:
function user_custom_roles() {
remove_role('custom_role'); //needed to "reset" the role
add_role(
'custom_role',
'Custom Role',
array(
'read' => true,
'delete_posts' => false,
'delete_published_posts' => false,
'edit_posts' => false, //IMPORTANT
'edit_published_posts' => true, //IMPORTANT
'edit_others_pages' => false,
'edit_others_posts' => false,
'publish_pages' => false,
'publish_posts' => false,
'upload_files' => true,
'unfiltered_html' => false
)
);
}
add_action('admin_init', 'user_custom_roles');