Codex

Function Reference/get usermeta

Contents

Description

This function returns the value of a specific metakey pertaining to the user whose ID is passed via the userid parameter.

Usage

 <?php get_usermeta$userid$metakey ); ?> 

Parameters

$userid
(integer) (required) The ID of the user whose data should be retrieved.
Default: None
$metakey
(string) (required) The metakey value to be returned.
Default: None

Example

This example returns and then displays the last name for user id 9.

<?php $user_last = get_usermeta(9,'last_name'); ?>
<?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>
User ID 9's last name: Jones

Change Log

Since: 2.0.0

Source File

get_usermeta() is located in wp-includes/user.php.

Related

get_usermeta(), update_usermeta(), delete_usermeta()

See also index of Function Reference and index of Template Tags.