Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Created November 22, 2011 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wpscholar/1386981 to your computer and use it in GitHub Desktop.
Save wpscholar/1386981 to your computer and use it in GitHub Desktop.
WordPress - Store timestamp of a user's last login as user meta
<?php
/**
* WordPress - Store timestamp of a user's last login as user meta
*/
function user_last_login( $user_login, $user ){
update_user_meta( $user->ID, '_last_login', time() );
}
add_action( 'wp_login', 'user_last_login', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment