diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index c3bb58f..94de600 100644
|
a
|
b
|
class WP_Roles { |
| 161 | 161 | * @return WP_Role|null WP_Role object if role is added, null if already exists. |
| 162 | 162 | */ |
| 163 | 163 | function add_role( $role, $display_name, $capabilities = array() ) { |
| 164 | | if ( isset( $this->roles[$role] ) ) |
| | 164 | if( empty( $role ) ) |
| 165 | 165 | return; |
| 166 | 166 | |
| | 167 | if ( isset( $this->roles[$role] ) ) |
| | 168 | return; |
| | 169 | |
| 167 | 170 | $this->roles[$role] = array( |
| 168 | 171 | 'name' => $display_name, |
| 169 | 172 | 'capabilities' => $capabilities |
| … |
… |
class WP_User { |
| 763 | 766 | * @param string $role Role name. |
| 764 | 767 | */ |
| 765 | 768 | function add_role( $role ) { |
| | 769 | |
| | 770 | if( empty( $role ) ) |
| | 771 | return; |
| | 772 | |
| 766 | 773 | $this->caps[$role] = true; |
| 767 | 774 | update_user_meta( $this->ID, $this->cap_key, $this->caps ); |
| 768 | 775 | $this->get_role_caps(); |
| … |
… |
function get_role( $role ) { |
| 1396 | 1403 | function add_role( $role, $display_name, $capabilities = array() ) { |
| 1397 | 1404 | global $wp_roles; |
| 1398 | 1405 | |
| | 1406 | if( empty( $role ) ) |
| | 1407 | return; |
| | 1408 | |
| 1399 | 1409 | if ( ! isset( $wp_roles ) ) |
| 1400 | 1410 | $wp_roles = new WP_Roles(); |
| 1401 | 1411 | |