add_user_meta( int $user_id, string $meta_key, mixed $meta_value, bool $unique = false )
Adds meta data to a user.
Parameters
- $user_id
-
(Required) User ID.
- $meta_key
-
(Required) Metadata name.
- $meta_value
-
(Required) Metadata value.
- $unique
-
(Optional) Whether the same key should not be added.
Default value: false
Return
(int|false) Meta ID on success, false on failure.
Source
File: wp-includes/user.php
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 |
---|---|
WP-3.0.0 | Introduced. |