Make WordPress Core


Ignore:
Timestamp:
09/09/2015 03:41:27 AM (9 years ago)
Author:
wonderboymusic
Message:

Ensure that role is not empty before adding it in add_role() function and methods.

Props MikeHansenMe, dannydehaan, michielhab.
Fixes #23746.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user.php

    r33958 r33967  
    440440     */
    441441    public function add_role( $role ) {
     442        if ( empty( $role ) ) {
     443            return;
     444        }
     445
    442446        $this->caps[$role] = true;
    443447        update_user_meta( $this->ID, $this->cap_key, $this->caps );
Note: See TracChangeset for help on using the changeset viewer.