Answers for "last login date time in wordpress"

PHP
0

last login date time in wordpress

#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 );
Posted by: Guest on August-31-2020

Browse Popular Code Answers by Language