WP_Roles::get_roles_data(): array
- Since
- 4.9.0
- Source
wp-includes/class-wp-roles.php:373
Gets the available roles data.
Return
array- Roles array.
Uses · 6
- is_multisite()Determines whether Multisite is enabled.
- get_current_blog_id()Retrieves the current site ID.
- remove_action()Removes a callback function from an action hook.
- get_blog_option()Retrieves option value for a given blog id based on name of option.
- add_action()Adds a callback function to an action hook.
- get_option()Retrieves an option value based on an option name.
Used by · 1
- WP_Roles::for_site()Sets the site to operate on. Defaults to the current site.
Source
protected function get_roles_data() { global $wp_user_roles; if ( ! empty( $wp_user_roles ) ) { return $wp_user_roles; } if ( is_multisite() && get_current_blog_id() !== $this->site_id ) { remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 ); $roles = get_blog_option( $this->site_id, $this->role_key, array() ); add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 ); return $roles; } return get_option( $this->role_key, array() ); }History
Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-roles.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.