Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress how to get all user meta data by user ID?

Tags:

wordpress

how to get all user meta data by user ID in Wordpress?

like image 972
Samir Bhattacharjee Avatar asked Feb 23 '12 10:02

Samir Bhattacharjee


2 Answers

@Boopathi Rejan nearly had it. Output all of the user meta by using the following code and then look through and find the values you

 $user_info = get_user_meta($current_user->ID);
 var_dump($user_info);

You can change the USERID to anything, currently this is setup to display the ID of the logged in user.

like image 87
raison Avatar answered Oct 21 '22 05:10

raison


  $user_info = get_userdata($userid);
  $username = $user_info->user_login;
  $first_name = $user_info->first_name;
  $last_name = $user_info->last_name;
like image 45
The Alpha Avatar answered Oct 21 '22 04:10

The Alpha