add_metadata ( $meta_type, $object_id, $meta_key, $meta_value, $unique = false )

  • (string) $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
  • (int) $object_id ID of the object metadata is for
  • (string) $meta_key Metadata key
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
  • (bool) $unique Optional, default is false. Whether the specified metadata key should be unique for the object. If true, and the object already has a value for the specified metadata key, no change will be made.
  • (int|false) The meta ID on success, false on failure.
Defined at:


Add metadata for the specified object.

Related Functions

add_meta, get_metadata, update_metadata, delete_metadata, wp_read_video_metadata

Top Google Results

User discussions

wpseek mobile