get_user_meta() – Retrieve user meta field for a user.

You appear to be a bot. Output may be restricted


Retrieves user meta field for a user.


$mixed = get_user_meta( $user_id, $key, $single );


( int ) required – User ID.
( string ) optional – Optional. The meta key to retrieve. By default, returns data for all keys.
( bool ) optional – Optional. Whether to return a single value. This parameter has no effect if $key is not specified. Default false.


mixed An array of values if $single is false. The value of meta data field if $single is true. False for an invalid $user_id (non-numeric, zero, or negative value). An empty string if a valid but non-existing user ID is passed.


File name: wordpress/wp-includes/user.php

1 to 3 of 3
function get_user_meta( $user_id, $key = '', $single = false ) {
  return get_metadata( 'user', $user_id, $key, $single );

 View on GitHub View on Trac