Function Reference/get metadata
Description
Retrieve metadata for the specified object.
Usage
<?php get_metadata($meta_type, $object_id, $meta_key = , $single = false) ?>
Parameters
- $meta_type
- (string) (required) Type of object metadata is for (e.g., comment, post, or user)
- Default: None
- $object_id
- (integer) (required) ID of the object metadata is for
- Default: None
- $meta_key
- (string) (optional) Optional. Metadata key. If not specified, retrieve all metadata for the specified object.
- Default:
- $single
- (boolean) (optional) 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.
- Default: false
Return Values
- (string)
- array
Change Log
Since: 2.9
Source File
get_metadata() is located in wp-includes/meta.php
Related
Metadata API:
add_metadata(),
get_metadata(),
update_metadata(),
delete_metadata()