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.

Top ↑

Parameters Parameters


(string) (Required) User meta key.


(mixed) (Required) User meta value.

Top ↑

Source Source

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

	public function __set( $key, $value ) {
		if ( 'id' === $key ) {
					/* translators: %s: WP_User->ID */
					__( 'Use %s instead.' ),
			$this->ID = $value;

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

Top ↑

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.