function get_user_meta($user_id, $key = '', $single = false) {}

Retrieve user meta field for a user.


  • int $user_id: Post ID.
  • string $key: The meta key to retrieve.
  • bool $single: Whether to return a single value.

Return values

returns:Will be an array if $single is false. Will be value of meta data field if $single is true.

Source code

function get_user_meta($user_id, $key = '', $single = false) {

	return get_metadata('user', $user_id, $key, $single);



One Response to “get_user_meta”

  1. hi,
    i use this function, but the return value is null..
    my code:

    $post_ids = get_user_meta(2,’user_favourite_post’);

    any help

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: