1

I installed BuddyPress which created additional user roles but even after deleting BuddyPress those roles are still there. How can I delete these roles? I have tried the remove_role() command but it did not work.

3
$wp_roles = new WP_Roles(); // create new role object
$wp_roles->remove_role('name_of_role');

If you need to check the name_of_role use

$wp_roles->get_names();

you will get an array of name_of_role => Nicename of Role

Alternatively, you could use the global object $wp_roles

global $wp_roles;
| improve this answer | |
2

A nice, user-friendly way of deleting your custom roles is using the Members plugin.

Once you install and activate it, go to Users > Roles and here you can delete an custom roles that you do not need, which you can see here:

enter image description here

Once you've remove the unwanted roles, you can simply delete the Members plugin.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.