bp_get_user_meta( int $user_id, string $key, bool $single = false )

Get a piece of usermeta.

Description

This is a wrapper for get_user_meta() that allows for easy use of bp_get_user_meta_key(), thereby increasing compatibility with non-standard BP setups.

See also

  • get_user_meta(): For complete details about parameters and return values.

Parameters

$user_id

(Required) The ID of the user whose meta you're fetching.

$key

(Required) The meta key to retrieve.

$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: bp-core/bp-core-functions.php

function bp_get_user_meta( $user_id, $key, $single = false ) {
	return get_user_meta( $user_id, bp_get_user_meta_key( $key ), $single );
}

Changelog

Changelog
Version Description
BuddyPress 1.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.