wppaste
WordPress

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

Since
3.3.0
Source
wp-includes/class-wp-user.php:351
Magic method for setting custom user fields.

Description

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

Parameters

$keystring
User meta key.
$valuemixed
User meta value.

Uses · 2

  • _deprecated_argument()Marks a function argument as deprecated and inform when it has been used.
  • __()Retrieves the translation of $text.

Source

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

History

Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/class-wp-user.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.