Skip to content

Instantly share code, notes, and snippets.

@alandbh
Created April 30, 2017 13:58
Show Gist options
  • Save alandbh/8e1c98782ca64ea3dc1521e0d01a5b23 to your computer and use it in GitHub Desktop.
Save alandbh/8e1c98782ca64ea3dc1521e0d01a5b23 to your computer and use it in GitHub Desktop.
Get user logged info. // Pega informações do usuário logado
/* Get user info. */
global $current_user, $wp_roles;
//get_currentuserinfo(); //deprecated since 3.1
$post_id = $_GET['post_id'];
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$avatarArr = get_field('avatar', 'user_'. $user_id ); //Using ACF
$avatarTbn = $avatarArr['sizes']['thumbnail'];
$user_email = $current_user->user_email;
$user_firstname = $current_user->user_firstname;
$display_name = $current_user->display_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment