add_metadata


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

Parameters:
  • (string) meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
  • (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. 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. Default false.
Returns:
  • (int|false) The meta ID on success, false on failure.
Defined at:

Description

Adds metadata for the specified object.

Related Functions

add_meta, get_metadata, delete_metadata, update_metadata, wp_read_audio_metadata

Top Google Results

User discussions

wpseek mobile