15 1 0 4000 1 https://codeblock.co.za 300 true 0
theme-sticky-logo-alt

get_user_meta()

0 Comments

Framework / CMS

WordPress [Version: Since 3.0.0]

Syntax

Typical Usage

Returns the user meta field for a given user in WordPress.

Accepted Parameters

  • user_id (integer) (Required): The ID for the user you need to get the meta for.
  • key (string) (Optional): The key for the meta you need to lookup. Leaving the key parameter blank will retrieve values for all meta keys.
  • single (boolean) (Optional): Whether or not to return a single value.

Return Value(s)

Returns an array if $single is false, the value of the meta field if $single is true and false for an invalid $user_id.

Notes

The $single parameter has no effect if $key is not specified.

Examples of get_user_meta()

Example 1

<?php

get_user_meta( $user_id, 'first_name', true )

Was This Helpful?

Previous Post
get_current_user_id()

0 Comments

Leave a Reply