Added environment checks for login_redirect WP hook.