Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created May 21, 2014 12:52
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 yanknudtskov/782ba61fee6c84d69b96 to your computer and use it in GitHub Desktop.
Save yanknudtskov/782ba61fee6c84d69b96 to your computer and use it in GitHub Desktop.
function my_redirect( $to, $requested, $user ){
if( !isset( $user->user_login ) ){ // we only want this to run when credentials have been supplied
return $to;
}
$regtime = strtotime($user->user_registered);
$now = strtotime("now");
$diff = $now - $regtime;
$hours = $diff / 60 / 60;
if( $hours < 48 ){
return "/somepage/"; // it's been less than 48 hours, redirect to message.
} else {
return admin_url();
}
}
add_filter('login_redirect', 'my_redirect', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment