WP_User::__isset
Magic method for checking the existence of a certain custom field.
Метод класса: WP_User{}
Хуков нет.
Возвращает
true|false. Whether the given user meta key is set.
Использование
$WP_User = new WP_User(); $WP_User->__isset( $key );
- $key(строка) (обязательный)
- User meta key to check if set.
Список изменений
| С версии 3.3.0 | Введена. |
Код WP_User::__isset() WP User:: isset WP 6.9.4
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 );
}