Tweaked to handle wp login case.