Function: get_usermeta

get_usermeta( integer $user_id, string $meta_key )

Retrieve user metadata.

If $user_id is not a number, then the function will fail over with a 'false' boolean return value. Other returned values depend on whether there is only one item to be returned, which be that single item type. If there is more than one metadata value, then it will be list of metadata values.


Name Type(s) Default Value Description
$user_id integer

User ID

$meta_key string ''

Optional. Metadata key.



WordPress Developer Newsletter

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