WordPress at a glance

add_user_meta() WP 1.0

Adds meta data to a user.

Works based on: add_metadata()

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.7.2

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

From tag: Metadatas (any)

No comments
    Log In