WP_User::init() WordPress Method

The WP_User::init() method is used to initialize a new WP_User object. This method is called when a new user is created.

WP_User::init( object $data, int $site_id = '' ) #

Sets up object properties, including capabilities.


Parameters

$data

(object)(Required)User DB row object.

$site_id

(int)(Optional) The site ID to initialize for.

Default value: ''


Top ↑

Source

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

	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 );
	}


Top ↑

Changelog

Changelog
VersionDescription
3.3.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.