Title: WP_User-&gt;remove_role wrong &#8212; code change
Last modified: August 18, 2016

---

# WP_User->remove_role wrong — code change

 *  [javalizard](https://wordpress.org/support/users/javalizard/)
 * (@javalizard)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/wp_user-gtremove_role-wrong-code-change/)
 * Hello all, I think there is an error in the WP_User->remove_role function.
 * This needs to be fixed:
 *     ```
       if ( empty($this->roles[$role]) ||
       (count($this->roles) <= 1) )
                               return;
                       unset($this->caps[$role]);
                       update_usermeta($this->ID, $this->cap_key, $this->caps);
                       $this->get_role_caps();
       ```
   
 * should be this:
 *     ```
       if ( empty($this->caps[$role]) ||
       (count($this->caps) <= 1) )
                               return;
                       unset($this->caps[$role]);
                       update_usermeta($this->ID, $this->cap_key, $this->caps);
                       $this->get_role_caps();
       ```
   
 * This has been stopping me from removing a user from a role. I’ve been manually
   fixing it with each new install but it should make it into the code base

Viewing 1 replies (of 1 total)

 *  Thread Starter [javalizard](https://wordpress.org/support/users/javalizard/)
 * (@javalizard)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/wp_user-gtremove_role-wrong-code-change/#post-611840)
 * While your at this one, can you fix this one too?
    [http://wordpress.org/support/topic/132841?replies=1](http://wordpress.org/support/topic/132841?replies=1)
 * I’m having both of these issues with roles

Viewing 1 replies (of 1 total)

The topic ‘WP_User->remove_role wrong — code change’ is closed to new replies.

## Tags

 * [change](https://wordpress.org/support/topic-tag/change/)
 * [code](https://wordpress.org/support/topic-tag/code/)
 * [remove_role](https://wordpress.org/support/topic-tag/remove_role/)
 * [wp_user](https://wordpress.org/support/topic-tag/wp_user/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [javalizard](https://wordpress.org/support/users/javalizard/)
 * Last activity: [18 years, 8 months ago](https://wordpress.org/support/topic/wp_user-gtremove_role-wrong-code-change/#post-611840)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
