get_registered_meta_keys

The timeline below displays how wordpress function get_registered_meta_keys has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Retrieves a list of registered metadata args for an object type, keyed by their meta keys.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
 *                               or any other object type with an associated meta table.
 * @param string $object_subtype Optional. The subtype of the object type. Default empty string.
 * @return array[] List of registered metadata args, keyed by their meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 6.1

/**
 * Retrieves a list of registered metadata args for an object type, keyed by their meta keys.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
 *                               or any other object type with an associated meta table.
 * @param string $object_subtype Optional. The subtype of the object type.
 * @return array[] List of registered metadata args, keyed by their meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 5.4

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
 *                               or any other object type with an associated meta table.
 * @param string $object_subtype Optional. The subtype of the object type.
 * @return string[] List of registered meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 9.8

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    The type of object. Post, comment, user, term.
 * @param string $object_subtype Optional. The subtype of the object type.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 9.3

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 *
 * @param string $object_type The type of object. Post, comment, user, term.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type)
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type])) {
        return array();
    }
    return $wp_meta_keys[$object_type];
}

WordPress Version: .20

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    The type of object. Post, comment, user, term.
 * @param string $object_subtype Optional. The subtype of the object type.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 9.2

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 *
 * @param string $object_type The type of object. Post, comment, user, term.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type)
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type])) {
        return array();
    }
    return $wp_meta_keys[$object_type];
}

WordPress Version: .10

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 * @since 4.9.8 The `$object_subtype` parameter was added.
 *
 * @param string $object_type    The type of object. Post, comment, user, term.
 * @param string $object_subtype Optional. The subtype of the object type.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type, $object_subtype = '')
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type]) || !isset($wp_meta_keys[$object_type][$object_subtype])) {
        return array();
    }
    return $wp_meta_keys[$object_type][$object_subtype];
}

WordPress Version: 4.6

/**
 * Retrieves a list of registered meta keys for an object type.
 *
 * @since 4.6.0
 *
 * @param string $object_type The type of object. Post, comment, user, term.
 * @return array List of registered meta keys.
 */
function get_registered_meta_keys($object_type)
{
    global $wp_meta_keys;
    if (!is_array($wp_meta_keys) || !isset($wp_meta_keys[$object_type])) {
        return array();
    }
    return $wp_meta_keys[$object_type];
}