Answer the question
In order to leave comments, you need to log in
How to display the user's first and last name on the screen in wordpress?
Greetings. How can I display the user's first and last name in wordpress? I use wp_get_current_user() function
$aboutuser = <a href="http://wp-kama.ru/function/wp_get_current_user">wp_get_current_user();</a>
var_dump($aboutuser);
{ ["data"]=> object(stdClass)#2670 (10) { ["ID"]=> string(1) "1" ["user_login"]=> string(5) "Mboat" ["user_pass"]=> string(34) "$P$BbDsCTGVe/Xtc" ["user_nicename"]=> string(5) "mboat" ["user_email"]=> string(21) "[email protected]" ["user_url"]=> string(0) "" ["user_registered"]=> string(19) "2015-12-11 08:25:20" ["user_activation_key"]=> string(0) "" ["user_status"]=> string(1) "0" ["display_name"]=> string(5) "Mboat" }..
$aboutuser->user_firstname;
$aboutuser->user_lastname;
Answer the question
In order to leave comments, you need to log in
Perhaps the answer to your question is here .
global $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;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question