Adds meta data to a user.
Parameters
$user_id
intrequired- User ID.
$meta_key
stringrequired- Metadata name.
$meta_value
mixedrequired- Metadata value. Must be serializable if non-scalar.
$unique
booloptional- Whether the same key should not be added.
Default:
false
Source
function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'user', $user_id, $meta_key, $meta_value, $unique );
}
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
Examples