Function Reference/add metadata
Description
Add metadata for the specified object in WordPress.
NOTE: This is a generic, low level function and should not be used directly by plugins or themes. Instead, use the corresponding meta functions for the object type you're working with:
Usage
<?php add_metadata( $meta_type, $object_id, $meta_key, $meta_value ); ?>
Parameters
- $meta_type
- (string) (required) Type of object the metadata is for (e.g., comment, post, or user). Always singular.
- Default: None
- $object_id
- (int) (required) The ID of the object metadata is for.
- Default: None
- $meta_key
- (string) (required) {{{3}}}
- Default: None
- $meta_value
- (string) (required) {{{3}}}
- Default: None
- $unique
- (bool) (Optional) This determines whether the specified key can have multiple entries for the specified object id. If false, add_metadata() will add duplicate keys to the object. If true, nothing will be added if the specified key already exists for the specified id.
- Default: False
Change Log
Source File
add_metadata() is located in wp-includes/meta.php.
Related
Metadata API:
add_metadata(),
get_metadata(),
update_metadata(),
delete_metadata()