How to view all the user roles configured in your wordpress and woocommerce site

view all the user roles configured in your wordpress and woocommerce site
Share:

You can do this as:

$editable_roles = get_editable_roles();
foreach ($editable_roles as $role => $details) {
    $sub['role'] = esc_attr($role);
    $sub['name'] = translate_user_role($details['name']);
    $roles[] = $sub;
}



echo '<pre>';
print_r( $roles ); // Should return an array of enabled user roles
echo '</pre>';

 

Share:

Related Posts