registered_meta_key_exists()
最后更新于:2021-11-27 21:15:16
registered_meta_key_exists( string$object_type, string$meta_key, string$object_subtype=”)Checks if a meta key is registered.
参数
- $object_type
-
(string) (Required) Type of object metadata is for. Accepts ‘post’, ‘comment’, ‘term’, ‘user’, or any other object type with an associated meta table.
- $meta_key
-
(string) (Required) Metadata key.
- $object_subtype
-
(string) (Optional) The subtype of the object type.
Default value: ”
响应
(bool) True if the meta key is registered to the object type and, if provided, the object subtype. False if not.
源文件
文件: gc-includes/meta.php
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 ] );
}