WPDev.one
Core Function
View Source on Trac ↗

get_registered_metadata()

get_registered_metadata( mixed $object_type, mixed $object_id, mixed $meta_key = '' )

Retrieves registered metadata for a specified object.

Parameters 3 required

Name / Type Description
string

$object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Required
$object_id
int

ID of the object the metadata is for.

Required
string

$meta_key Optional. Registered metadata key. If not specified, retrieve all registered metadata for the specified object.

Required

Return Value

(mixed)
mixed A single value or array of values for a key if specified. An array of all registered keys and values for an object ID if not. False if a given $meta_key is not registered.

Function Information

Since Version
4.6.0
Source File
wp-includes/meta.php
Advertisement