Function Reference/update usermeta

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.

Contents

Description

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.

Gotchas

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.

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.