On this page
WP_User::init( object $data, int $site_id = '' )
Sets up object properties, including capabilities.
Parameters
$dataobject Required-
User DB row object.
$site_idint Optional-
The site ID to initialize for.
Default:
''
Source
File: wp-includes/class-wp-user.php. View all references
public function init( $data, $site_id = '' ) {
if ( ! isset( $data->ID ) ) {
$data->ID = 0;
}
$this->data = $data;
$this->ID = (int) $data->ID;
$this->for_site( $site_id );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_User::for_site() wp-includes/class-wp-user.php | Sets the site to operate on. Defaults to the current site. |
Used By
| Used By | Description |
|---|---|
| WP_User::__construct() wp-includes/class-wp-user.php | Constructor. |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_user/init