Skip to content

Instantly share code, notes, and snippets.

@csaborio001
Created July 16, 2020 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csaborio001/497ebfdab7ccfd44263933877264471e to your computer and use it in GitHub Desktop.
Save csaborio001/497ebfdab7ccfd44263933877264471e to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_login', 'wppb_toolbox_count_user_logins', 20, 2 );
function wppb_toolbox_count_user_logins( $user_login, $user ) {
if ( empty($user->ID) ) return;
$now = new DateTime( 'now', wp_timezone() );
update_user_meta( $user->ID, 'last_login_date', $now->format( 'Y-m-d H:i:s' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment