WP_User::__unset() WordPress Method
The __unset() method of the WP_User class allows for the removal of a usermeta value for a given user.
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',
'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 ] );
}
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |