Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/update usermeta

← Return to function reference.

This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.


This function is deprecated as of Version 3.0. Please use update_user_meta instead.

This function updates the value of a specific meta_key pertaining to the user whose ID is passed via the userid parameter. It returns true if the update was successful and resulted in a new or changed record, and false otherwise.


  1. meta-key: Alphanumeric and underscore only. If the meta_key contains any characters besides [A-Za-z0-9_] (i.e. anything but letters, digits, and underscore), it is automatically stripped and inserted without the disallowed characters. For example, "opt-in" becomes "optin" – hyphen is not allowed in a meta_key.
  2. return value: unchanged record treated as error. If the new meta_value matches an existing value, the operation is considered an error and false is returned.


 <?php update_usermeta$userid$metakey$metavalue ); ?> 


(integer) (required) The ID of the user whose data should be updated.
Default: None
(string) (required) The meta_key to be updated.
Default: None
(mixed) (required) The new desired value of the meta_key, which must be different from the existing value. Arrays and objects will be automatically serialized.
Default: None

Return Values

  • True on successful update.
  • False on update failure.

Change Log

Since: 2.0.0

Source File