我在functions.php文件中有这个功能
add_action( 'wp_login', 'the_function', 99 );
function the_function( $login ) {
$user = get_user_by('login',$login);
$user_ID = $user->ID;
//do something with the User ID
echo "<script type='text/javascript'>alert('first authentication ran successfully for " . $user->user_email. "!')</script>";
}
一旦用户登录,它应该显示一个弹出框,但似乎根本没有发生任何事情。不确定我做错了什么。挂钩是否不会立即触发该功能?