registered_meta_key_exists( string $object_type, string $meta_key )

Checks if a meta key is registered.


Description Description


Parameters Parameters

$object_type

(string) (Required) The type of object.

$meta_key

(string) (Required) The meta key.


Top ↑

Return Return

(bool) True if the meta key is registered to the object type. False if not.


Top ↑

Source Source

File: wp-includes/meta.php

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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.