get_user_meta( int $user_id, string $key = '', bool $single = false )
Retrieve user meta field for a user.
Parameters
- $user_id
-
(Required) User ID.
- $key
-
(Optional) The meta key to retrieve. By default, returns data for all keys.
Default value: ''
- $single
-
(Optional) Whether to return a single value.
Default value: false
Return
(mixed) Will be an array if $single is false. Will be value of meta data field if $single is true.
Source
File: wp-includes/user.php
function get_user_meta($user_id, $key = '', $single = false) {
return get_metadata('user', $user_id, $key, $single);
}
Changelog
Version | Description |
---|---|
WP-3.0.0 | Introduced. |