How to Echo or Print WP current logged in user email in the API URL?
Question
I m calling an External HTTP API into WordPress and I am getting responses but my problem is i want to print Current logged in user email inside the url dynamically. I am able to print or display Current logged in user email in wordpress site with the following code:
$current_user = wp_get_current_user();
$custemail=$current_user->user_email;
<?php echo $current_user->user_email;?>
But I wan to print this in the API URL
https://httpapi.com/api/customers/details.json?auth-userid=XXX&api-key=XXX&username=<?php echo $current_user->user_email;?>
username=<?php echo $current_user->user_email;?>
So I will get the API response based on the current user logged in email address as a selector. But not getting any response using the echo code in the url. I cant figure out whats wrong?
0
http-api, wordpress.org
4 years
2019-11-06T08:53:45-05:00
2019-11-06T08:53:45-05:00 0 Answers
63 views
0
Leave an answer