Get current user data in wordpress

Sangwan Pankaj Reply 09:54
Use wp_get_current_user() to get current users value.
  wp_get_current_user() return WP_User object. 
<?php
    $current_user 
wp_get_current_user();
    
echo 'Username: ' $current_user->user_login '<br />';
    echo 
'User email: ' $current_user->user_email '<br />';
    echo 
'User first name: ' $current_user->user_firstname '<br />';
    echo 
'User last name: ' $current_user->user_lastname '<br />';
    echo 
'User display name: ' $current_user->display_name '<br />';
    echo 
'User ID: ' $current_user->ID '<br />';?>

Related Posts

Wordpress 4518402331710800728
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us