WP_User::__set()publicWP 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.

Метод класса: WP_User{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WP_User = new WP_User();
$WP_User->__set( $key, $value );
$key(строка) (обязательный)
User meta key.
$value(разное) (обязательный)
User meta value.

Список изменений

С версии 3.3.0 Введена.

Код WP_User::__set() WP 6.5.2

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