WP_Roles::__construct() WordPress Method

The WP_Roles::__construct() method is used to instantiate a new WP_Roles object. This object can be used to retrieve a list of all the roles defined on the site, add new roles, and remove existing roles.

WP_Roles::__construct( int $site_id = null ) #

Constructor


Parameters

$site_id

(int)(Optional)Site ID to initialize roles for. Default is the current site.

Default value: null


Top ↑

Source

File: wp-includes/class-wp-roles.php

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

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

		$this->for_site( $site_id );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0The $site_id argument was added.
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.