A WordPress-centric search engine for devs and theme authors



registered_meta_key_exists ›

Since4.6.0
Deprecatedn/a
registered_meta_key_exists ( $object_type, $meta_key )
Parameters: (2)
  • (string) $object_type The type of object.
    Required: Yes
  • (string) $meta_key The meta key.
    Required: Yes
Returns:
  • (bool) True if the meta key is registered to the object type. False if not.
Defined at:
Codex:

Checks if a meta key is registered.



Source

function registered_meta_key_exists( $object_type, $meta_key ) {
	global $wp_meta_keys;

	if ( ! is_array( $wp_meta_keys ) ) {
		return false;
	}

	if ( ! isset( $wp_meta_keys[ $object_type ] ) ) {
		return false;
	}

	if ( isset( $wp_meta_keys[ $object_type ][ $meta_key ] ) ) {
		return true;
	}

	return false;
}