Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Current user info 2

Retrieve current user information the old way, using get_currentuserinfo() and various separate global variables.

global $user_login, $user_ID, $user_email, $display_name;
get_currentuserinfo();

printf( __( 'Username: %s', 'textdomain' ), esc_html( $user_login ) ) . '<br />';
printf( __( 'User ID: %s', 'textdomain' ), esc_html( $user_ID ) ) . '<br />';
printf( __( 'User Email: %s', 'textdomain' ), esc_html( $user_email ) ) . '<br />';
printf( __( 'User Display Name: %s', 'textdomain' ), esc_html( $display_name ) ) . '<br />';