WP_Roles::get_roles_data() protected WP 4.9.0
Gets the available roles data.
{} Это метод класса: WP_Roles{}
Хуков нет.
Возвращает
Массив
. Roles array.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_roles_data();
Заметки
- Global. Массив. $wp_user_roles Used to set the 'roles' property value.
Список изменений
С версии 4.9.0 | Введена. |
Код WP_Roles::get_roles_data() WP Roles::get roles data WP 5.7.1
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() );
}