Add metadata for the specified object.

Signature

add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false )
meta_type
 (string) Type of object metadata is for (e.g., comment, post, or user)
object_id
 (int) ID of the object metadata is for
meta_key
 (string) Metadata key
meta_value
 (mixed) Metadata value. Must be serializable if non-scalar.
unique
 (boolean) 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
Default: false

Return

(int|boolean) The meta ID on success, false on failure.

Source

function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
	global $wpdb;

	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
		return false;
	}

	$object_id = absint( $object_id );
	if ( ! $object_id ) {
		return false;
	}

	$table = _get_meta_table( $meta_type );
	if ( ! $table ) {
		return false;
	}

	$column = sanitize_key($meta_type . '_id');

	// expected_slashed ($meta_key)
76 more lines...
WP Trac GitHub

Link here