Core Function
View Source on Trac ↗ update_user_meta()
update_user_meta( mixed $user_id, mixed $meta_key, mixed $meta_value, mixed $prev_value = '' ) Updates user meta field based on user ID.
Parameters 4 required
| Name / Type | Description |
|---|---|
| $user_id int | User ID. Required |
| $meta_key string | Metadata key. Required |
| $meta_value mixed | Metadata value. Must be serializable if non-scalar. Required |
| mixed | $prev_value Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default empty. Required |
Return Value
((int)
(int | bool) Meta ID if the key didn't exist, true on successful update,
false on failure or if the value passed to the function
is the same as the one that is already in the database.
Function Information
Since Version
3.0.0
Source File
wp-includes/user.php
Advertisement