WP_User::__unset
Magic method for unsetting a certain custom field.
Method of the class: WP_User{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WP_User = new WP_User(); $WP_User->__unset( $key );
- $key(string) (required)
- User meta key to unset.
Changelog
| Since 4.4.0 | Introduced. |
WP_User::__unset() WP User:: unset code WP 6.8.3
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 ] );
}
}