WP_User::__unset( string $key )

Magic method for unsetting a certain custom field.


Parameters

$key

(string) (Required) User meta key to unset.


Source

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

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

		if ( isset( $this->data->$key ) ) {
			unset( $this->data->$key );
		}

		if ( isset( self::$back_compat_keys[ $key ] ) ) {
			unset( self::$back_compat_keys[ $key ] );
		}
	}


Changelog

Changelog
Version Description
WP-4.4.0 Introduced.