[ad_1]
I have created a number of customer roles which show up and can be selected in your checkbox UI. They don’t get saved though. Non-custom ones do get saved.
I’m on PHP 8.3 and WordPress 6.5.3 , nothing shows in the PHP error log.
//============================================================================
function AddBungalookRole($RoleName, $RoleOptions)
// CREATE ROLES
//============================================================================
{
add_role("Bungalook_{$RoleName}", "Bungalook {$RoleName}", $RoleOptions);
}
//============================================================================
function CreateBungalookUserSecurityRoles()
// CREATE ROLES
//============================================================================
{
$RoleOptions = [
'read' => true,
'create_posts' => true,
'edit_posts' => true,
'edit_others_posts' => true,
'publish_posts' => true,
'manage_categories' => true,
];
AddBungalookRole('Newsletters', $RoleOptions);
AddBungalookRole('Orders', $RoleOptions);
AddBungalookRole('Plants', $RoleOptions);
AddBungalookRole('Reimbursements', $RoleOptions);
}
add_action( 'init', 'CreateBungalookUserSecurityRoles' );
