last login date time in wordpress
snippet in php

last login date time in wordpress

user341

#Set
function user_last_login( $user_login, $user ) {
    update_user_meta( $user->ID, 'last_login', time() );
}
add_action( 'wp_login', 'user_last_login', 10, 2 );

#get
echo get_user_meta( $user->ID, 'last_login' , true );