WP_User::__isset( string $key ): bool
- Since
- 3.3.0
- Source
wp-includes/class-wp-user.php:277
Magic method for checking the existence of a certain custom field.
Parameters
$keystring- User meta key to check if set.
Return
bool- Whether the given user meta key is set.
Uses · 3
- _deprecated_argument()Marks a function argument as deprecated and inform when it has been used.
- __()Retrieves the translation of $text.
- metadata_exists()Determines if a meta field with the given key exists for the given object ID.
Used by · 1
- WP_User::has_prop()Determines whether a property or meta key is set.
Source
public function __isset( $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>' ) ); $key = 'ID'; } if ( isset( $this->data->$key ) ) { return true; } if ( isset( self::$back_compat_keys[ $key ] ) ) { $key = self::$back_compat_keys[ $key ]; } return metadata_exists( 'user', $this->ID, $key ); }History
Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/class-wp-user.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.