WordPress at a glance
function is not described

WP_Roles::__construct() public WP 2.0.0

Constructor

{} It's a method of the class: WP_Roles{}

No Hooks.

Return

null. Nothing.

Usage

global $wp_roles;
$wp_roles->__construct( $site_id );
$site_id(int)
Site ID to initialize roles for.
Default: current site

Notes

  • Global. Array. $wp_user_roles Used to set the 'roles' property value.

Changelog

Since 2.0.0 Introduced.
Since 4.9.0 The $site_id argument was added.

Code of WP_Roles::__construct() WP 5.7.2

<?php
public function __construct( $site_id = null ) {
	global $wp_user_roles;

	$this->use_db = empty( $wp_user_roles );

	$this->for_site( $site_id );
}