WP_Roles::__construct()publicWP 2.0.0

Constructor.

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.

WP_Roles::__construct() code WP 6.1.1

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

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

	$this->for_site( $site_id );
}