WPDev.one
Core Class

WP_Roles

class WP_Roles // Constructor: function Object() { [native code] }

Core class used to implement a user roles API.

Methods 15 methods

Method / Return Description
__construct()
void

Constructor.

Parameters: $site_id: mixed
__call()
(mixed

Makes private/protected methods readable for backward compatibility.

Parameters: $name: mixed, $arguments: mixed
_init()
void

Sets up the object properties.

reinit()
void

Reinitializes the object.

add_role()
(WP_Role

Adds a role name with capabilities to the list.

Parameters: $role: mixed, $display_name: mixed, $capabilities: mixed
remove_role()
void

Removes a role by name.

Parameters: $role: mixed
add_cap()
void

Adds a capability to role.

Parameters: $role: mixed, $cap: mixed, $grant: mixed
remove_cap()
void

Removes a capability from role.

Parameters: $role: mixed, $cap: mixed
get_role()
(WP_Role

Retrieves a role object by name.

Parameters: $role: mixed
get_names()
string[]

Retrieves a list of role names.

is_role()
bool

Determines whether a role name is currently in the list of available roles.

Parameters: $role: mixed
init_roles()
void

Initializes all of the available roles.

for_site()
void

Sets the site to operate on. Defaults to the current site.

Parameters: $site_id: mixed
get_site_id()
int

Gets the ID of the site for which roles are currently initialized.

get_roles_data()
array

Gets the available roles data.

Properties

Property / Type Description
$roles
mixed
public
No description available.
$role_objects
mixed
public
No description available.
$role_names
mixed
public
No description available.
$role_key
mixed
public
No description available.
$use_db
mixed
public
No description available.
$site_id
mixed
public
No description available.

Class Information

Since Version
2.0.0
Source File
wp-includes/class-wp-roles.php
Advertisement