Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get email of user that is logged in in wordpress [closed]

Tags:

php

wordpress

I have a question about wordpress. I need a function that can return me the email of the user that is logged in. I'm interested in Authors. Can anybody help me? Thank you!

like image 217
user2358350 Avatar asked Nov 27 '22 21:11

user2358350


1 Answers

In wordpress, you can use below function:

global $current_user;
get_currentuserinfo();
echo $current_user->user_email;

For latest version WordPress 4.5 and greater

$current_user = wp_get_current_user();
echo $current_user->user_email;
like image 147
Bhumi Shah Avatar answered Dec 08 '22 00:12

Bhumi Shah