使用WP 5.2.4,I am registering my custom post type with this code:
$args = array(
\'labels\' => $labels,
\'public\' => false,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'has_archive\' => false,
\'menu_position\' => null,
\'map_meta_cap\' => false,
\'capability_type\' => [\'note\',\'notes\'],
\'rewrite\' => [ \'slug\' => \'note\', \'with_front\' => false ],
\'supports\' => [ \'editor\' ],
\'menu_icon\' => \'dashicons-format-aside\',
);
register_post_type( \'note\', $args );
Now I want my custom user role to edit/read/delete this post type. I added this caps to my custom user role: $role = get_role( \'my_custom_role\' );
$role->add_cap(\'read_private_notes\');
$role->add_cap(\'read_note\');
$role->add_cap(\'read\');
$role->add_cap(\'publish_notes\');
$role->add_cap(\'edit_note\');
$role->add_cap(\'edit_notes\');
$role->add_cap(\'edit_others_notes\');
$role->add_cap(\'edit_private_notes\');
$role->add_cap(\'edit_published_notes\');
$role->add_cap(\'edit_notes\');
$role->add_cap(\'delete_note\');
$role->add_cap(\'delete_notes\');
$role->add_cap(\'delete_private_notes\');
$role->add_cap(\'delete_published_notes\');
$role->add_cap(\'delete_others_notes\');
Everything is OK for the administrator role and post type item shows in the admin menu. For other roles, it shows the admin menu item but in the post type list page give permission error.
