WordPress.org

Support

Support » Requests and Feedback » remove_role() possible bug

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.
Skip to toolbar