Function: update_usermeta

update_usermeta( integer $user_id, string $meta_key, mixed $meta_value )

Update metadata of user.

There is no need to serialize values, they will be serialized if it is needed. The metadata key can only be a string with underscores. All else will be removed.

Will remove the metadata, if the meta value is empty.

Parameters

Name Type(s) Default Value Description
$user_id integer

User ID

$meta_key string

Metadata key.

$meta_value mixed

Metadata value.

Returns

boolean

True on successful update, false on failure.

WordPress Developer Newsletter

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