Title: remove_role() possible bug
Last modified: August 19, 2016

---

# remove_role() possible bug

 *  [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * (@shinephp)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/remove_role-possible-bug/)
 * remove_role() function in capabilities.php has the return operator
 *     ```
       return $wp_roles->remove_role( $role );
       ```
   
 * But $wp_roles->remove_role() returns nothing
 *     ```
       function remove_role( $role )
       if ( ! isset( $this->role_objects[$role] ) )
       return;
       unset( $this->role_objects[$role] );
       unset( $this->role_names[$role] );
       unset( $this->roles[$role] );
       if ( $this->use_db )
       update_option( $this->role_key, $this->roles );
       }
       ```
   
 * I think it should be
 *     ```
       function remove_role( $role ) {
       if ( ! isset( $this->role_objects[$role] ) )
       return false;
       unset( $this->role_objects[$role] );
       unset( $this->role_names[$role] );
       unset( $this->roles[$role] );
       if ( $this->use_db )
       return update_option( $this->role_key, $this->roles );
       } else {
       return true;
       }
       ```
   
 * Please confirm if this bug is known or not.

The topic ‘remove_role() possible bug’ is closed to new replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 0 replies
 * 1 participant
 * Last reply from: [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/remove_role-possible-bug/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
