Answers for "How do I display logged-in username IF logged-in? site:wordpress.stackexchange.com"

PHP
0

How do I display logged-in username IF logged-in? site:wordpress.stackexchange.com

<?php global $current_user; wp_get_current_user(); ?>
<?php if ( is_user_logged_in() ) { 
 echo 'Username: ' . $current_user->user_login . "\n"; echo 'User display name: ' . $current_user->display_name . "\n"; } 
else { wp_loginout(); } ?>
Posted by: Guest on August-03-2020

Code answers related to "How do I display logged-in username IF logged-in? site:wordpress.stackexchange.com"

Browse Popular Code Answers by Language