registered_meta_key_exists()WP 4.6.0

Checks if a meta key is registered.

Хуков нет.


true|false. True if the meta key is registered to the object type and, if provided, the object subtype. False if not.


registered_meta_key_exists( $object_type, $meta_key, $object_subtype );
$object_type(строка) (обязательный)
Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
$meta_key(строка) (обязательный)
Metadata key.
The subtype of the object type.
По умолчанию: empty string

Список изменений

С версии 4.6.0 Введена.
С версии 4.9.8 The $object_subtype parameter was added.

Код registered_meta_key_exists() WP 6.5.3

function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = '' ) {
	$meta_keys = get_registered_meta_keys( $object_type, $object_subtype );

	return isset( $meta_keys[ $meta_key ] );