Skip to content

Instantly share code, notes, and snippets.

@Tsunamijaan
Created January 5, 2019 08:57
Show Gist options
  • Select an option

  • Save Tsunamijaan/7a56ab838bec11fdd32f7caff577fbdb to your computer and use it in GitHub Desktop.

Select an option

Save Tsunamijaan/7a56ab838bec11fdd32f7caff577fbdb to your computer and use it in GitHub Desktop.
Logged In Users Current Info
<?php global $current_user;
get_currentuserinfo();
echo 'Username: ' . $current_user->user_login . "\n";
echo 'User email: ' . $current_user->user_email . "\n";
echo 'User first name: ' . $current_user->user_firstname . "\n";
echo 'User last name: ' . $current_user->user_lastname . "\n";
echo 'User display name: ' . $current_user->display_name . "\n";
echo 'User ID: ' . $current_user->ID . "\n";
?>
Avatar Uses:============
<?php
global $current_user;
get_currentuserinfo();
echo get_avatar( $current_user->ID, 50 );
//Here 50 is avatar size
?>
Get login user Name:=================
<?php
global $current_user;
get_currentuserinfo();
echo echo $current_user->user_login;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment