Permit users with author role to edit a custom post type

I have this already coded project which has a custom post type with a certain behavior: it is only a single post and admins/editors/authors can only edit its content. it’s content is a custom data table.
administrators and editors can edit just fine. i want Authors to be able to edit this single post as well but i can’t seem to be able to find out how.
the code is this:

add_action(‘init’, ‘register_post_types’);
function register_post_types(){

register_post_type(‘post_type_uo’, array(
‘labels’ => array(
‘name’ => ‘uo Articles’,
‘singular_name’ => ‘uo’,
‘add_new’ => ‘Add uo’,
‘edit_item’ => ‘Edit Post’,
‘view_item’ => ‘View Post’,
‘search_items’ => ‘Find Post’,
‘not_found’ => ‘Not Found’,
‘not_found_in_trash’ => ‘Not Found’,
‘parent_item_colon’ => ”,
‘menu_name’ => ‘uo’,
),
‘public’ => true,
‘menu_position’ => 4,
‘exclude_from_search’ => true,
‘has_archive’ => false,
‘rewrite’ => array(‘slug’ => ‘daily-uo’),
‘taxonomies’ => array( ‘dailies’ , ‘category’),
‘menu_icon’ => ‘dashicons-chart-line’, // custom icon
‘capabilities’ => array(‘create_posts’ => false,),
‘map_meta_cap’ => true,
‘supports’ => array(‘title’)
));
}

i tried to add a capabilities array and then installed “Members” plugin.

‘capabilities’ => array(
‘create_posts’ => ‘do_not_allow’, // false < WP 4.5, credit @Ewout
‘read_posts’ => ‘read_uos’,
‘edit_post’ => ‘edit_uo’,
‘edit_posts’ => ‘edit_uos’,
‘published_posts’ => ‘publish_uo’,
‘edit_published_posts’ => ‘edit_uo_p’,
‘edit_others_posts ‘ => ‘edit_uo_others’
),

i can see the capabilities in plugin’s roles page and select them but still no edit access for users with the Athor role.

Finally i made a new role -uo_Author- via the plugin giving the correct(??) permissions but still no luck

any ideas?

Read more here:: Permit users with author role to edit a custom post type

Leave a Reply

Your email address will not be published. Required fields are marked *