How can I get the current user email instead of user ID?

add_shortcode( ‘current_user_link’, ‘wppbc_current_user_link’ );
function wppbc_current_user_link( $atts, $content ) {
if ( is_user_logged_in() ) {
$id = get_current_user_id();
// make sure to change the URL to represent your setup.
return “http://website.com/user-listing-page/user/{$id}’>Your User Page”;
}

return ;
}

Read more here:: How can I get the current user email instead of user ID?

Leave a Reply

Your email address will not be published. Required fields are marked *