Magic method for unsetting a certain custom field.
Parameters
$key
stringrequired- 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
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.