remove_role not working
-
Not sure what is going wrong, but when I use the following code I am able to add a role to a specific user, however, I am not able to remove a role using the remove_role command.
Any ideas?
I can add a role using the following code:
global $user_ID; $user = new WP_User($user_ID); $user->add_role('some_role_name');
But this does not remove the role:
$user->remove_role('some_role_name');
I’m checking what roles are associated to the user using the following code:
foreach ($user->roles as $role) { echo "HAS ROLE: $role<br />"; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘remove_role not working’ is closed to new replies.