Definition:
function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {}
Retrieve metadata for the specified object.
Parameters
- string $meta_type: Type of object metadata is for (e.g., comment, post, or user)
- int $object_id: ID of the object metadata is for
- string $meta_key: Optional. Metadata key. If not specified, retrieve all metadata for the specified object.
- bool $single: Optional, default is false. If true, return only the first value of the specified meta_key. This parameter has no effect if meta_key is not specified.
Return values
returns:Single metadata value, or array of values
Defined filters
- get_{$meta_type}_metadata
apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single )
Source code
function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { if ( !$meta_type ) return false; if ( !$object_id = absint($object_id) ) return false; $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
1482
No comments yet... Be the first to leave a reply!