Easy way: use this plugin https://wordpress.org/plugins/user-role-editor/
More complicated way: You can use functions.php to add all of the custom capabilities to a specific roles. But ofc you need a name of these capabilities.
This code is usefull if you want to add X same capabilities to X roles.
Add to functions.php
function wphm_add_custom_capabilities_to_roles($roles, $capabilities) {
foreach($roles as $the_role) {
$role = get_role($the_role);
foreach($capabilities as $capability) {
$role -> add_cap($capability);
}
}
}
wphm_add_custom_capabilities_to_roles(
array( // these roles will recieve capabilities
'custom_user_role_wphm_support',
'administrator'
),
array( // capabilities
"read_wphm_custom",
"read_private_wphm_custom",
"edit_wphm_custom",
"edit_others_wphm_custom",
"edit_published_wphm_custom",
"publish_wphm_custom",
"delete_others_wphm_custom",
"delete_private_wphm_custom",
"delete_published_wphm_custom"
)
);
To remove a capability with this loop just modify a line $role -> add_cap($capability); to $role -> remove_cap($capability)