Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/7f82ed0a2d771fa8f155915aeab72bf7 to your computer and use it in GitHub Desktop.
Save someguy9/7f82ed0a2d771fa8f155915aeab72bf7 to your computer and use it in GitHub Desktop.
Retrieve current logged in user's ID, Email, Name
<?php
$current_user = wp_get_current_user();
echo 'Username: '.$current_user->user_login;
echo 'User ID: '.$current_user->ID;
echo 'User Email: '.$current_user->user_email;
echo 'User First Name: '.$current_user->user_firstname;
echo 'User Last Name: '.$current_user->user_lastname;
echo 'User Display Name: '.$current_user->display_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment