In my project in one of the pages of the backoffice that I created for the user is to see my referrals, I am using wordpress, and this referral page will be done by php since I have to make queries in the databases. / p>
I know that with this function I recover the variables that I want from the logged in user:
if (is_user_logged_in()){
$cu = wp_get_current_user();
echo 'Nombre de usuario: ' . $cu->user_login . '<br />';
}
In fact, I've put this in my php and it gives me an error, I do not know if I have to put this function in the functions and then pass it to another php or not?
The query and others know how to do it I need to get the logged-in user and with that I would do the query.