WordPress at Your Fingertips

add_user_meta() WP 1.0

Adds meta data to a user.

No Hooks.


Int|false. Meta ID on success, false on failure.


add_user_meta( $user_id, $meta_key, $meta_value, $unique );
$user_id(int) (required)
User ID.
$meta_key(string) (required)
Metadata name.
$meta_value(mixed) (required)
Metadata value. Must be serializable if non-scalar.
Whether the same key should not be added.
Default: false


Since 3.0.0 Introduced.

Code of add_user_meta() WP 5.8.1

function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
	return add_metadata( 'user', $user_id, $meta_key, $meta_value, $unique );

Metadatas (any)

No comments
    Log In