WP_User::__set( string $key, mixed $value )

Magic method for setting custom user fields.


Description Description

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


Parameters Parameters

$key

(string) (Required) User meta key.

$value

(mixed) (Required) User meta value.


Top ↑

Source Source

File: wp-includes/class-wp-user.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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.