WordPress at a glance
function is not described

WP_User::__set() public WP 3.3.0

Magic method for setting custom user fields.

This method does not update custom fields in the database. It only stores the value on the WP_User instance.

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

No Hooks.

Return

````. Null. Nothing.

Usage

$WP_User = new WP_User();
$WP_User->__set( $key, $value );
$key(string) (required)
User meta key.
$value(mixed) (required)
User meta value.

Changelog

Since 3.3.0 Introduced.

Code of WP_User::__set() WP 5.7

<?php
public function __set( $key, $value ) {
	if ( 'id' === $key ) {
		_deprecated_argument(
			'WP_User->id',
			'2.1.0',
			sprintf(
				/* translators: %s: WP_User->ID */
				__( 'Use %s instead.' ),
				'<code>WP_User->ID</code>'
			)
		);
		$this->ID = $value;
		return;
	}

	$this->data->$key = $value;
}