PHPWooCommerceWordPress

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

0
758
2018 / 04 / 30

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>';

 

Hi, I am a full-stack web developer with 5+ years of experience in working with different web technologies. Do you want to ask something? just send me a message through the contact form. Please visit my portfolio at hamzamehmood.com. Thanks