WordPress: Get current user's username or ID

There is a global variable called "$current_user".

global $current_user;

And in there is a field called "user_login".

$current_user->user_login;

You can also use "$current_user->id" to get the user id.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog