Function: add_user_meta

add_user_meta( integer $user_id, string $meta_key, mixed $meta_value, boolean $unique )

Adds meta data to a user.


Name Type(s) Default Value Description
$user_id integer

User ID.

$meta_key string

Metadata name.

$meta_value mixed

Metadata value.

$unique boolean false

Optional. Whether the same key should not be added. Default false.


integer | false

Meta ID on success, false on failure.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.