get_registered_meta_keys()

最后更新于:2021-11-26 23:26:13

get_registered_meta_keys( string$object_type, string$object_subtype=”)

Retrieves a list of registered meta keys for an object type.

参数

$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.

$object_subtype

(string) (Optional) The subtype of the object type.

Default value: ”

响应

(string[]) List of registered meta keys.

源文件

文件: gc-includes/meta.php

function get_registered_meta_keys( $object_type, $object_subtype = '' ) {
	global $gc_meta_keys;

	if ( ! is_array( $gc_meta_keys ) || ! isset( $gc_meta_keys[ $object_type ] ) || ! isset( $gc_meta_keys[ $object_type ][ $object_subtype ] ) ) {
		return array();
	}

	return $gc_meta_keys[ $object_type ][ $object_subtype ];
}