WordPress at a glance
function is not described

WP_Roles::init_roles() public WP 4.9.0

Initializes all of the available roles.

This is a method of the class: WP_Roles{}

Hooks from the method
Return

Null. Nothing.

Usage

$WP_Roles = new WP_Roles();
\$WP_Roles->init_roles();

Changelog

Since 4.9.0 Introduced.

Code of WP Roles::init roles: wp-includes/class-wp-roles.php WP 5.4.2

<?php
public function init_roles() {
	if ( empty( $this->roles ) ) {
		return;
	}

	$this->role_objects = array();
	$this->role_names   = array();
	foreach ( array_keys( $this->roles ) as $role ) {
		$this->role_objects[ $role ] = new WP_Role( $role, $this->roles[ $role ]['capabilities'] );
		$this->role_names[ $role ]   = $this->roles[ $role ]['name'];
	}

	/**
	 * After the roles have been initialized, allow plugins to add their own roles.
	 *
	 * @since 4.7.0
	 *
	 * @param WP_Roles $this A reference to the WP_Roles object.
	 */
	do_action( 'wp_roles_init', $this );
}