WP_User::__unset( string $key )

In this article

Magic method for unsetting a certain custom field.

Parameters

$keystringrequired
User meta key to unset.

Source

public function __unset( $key ) {
	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>'
			)
		);
	}

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

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

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

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