Frontend Display
-
Hey I noticed there’s no clear documentation on how to display this data on the frontend so I figured I would share this code:
global $current_user; $user_last_login_timestamp = get_user_meta( $current_user->id, 'wp-last-login', true ); $user_last_login = date('F j, Y g:i a', $user_last_login_timestamp); //see date() for more info in PHP manual echo '<p>Last login:'.$user_last_login.'</p>';
Basically this is pulling the timestamp from usermeta and formatting it. It’s easily customizable. Hopefully this helps someone out.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Frontend Display’ is closed to new replies.