WP Login Redirects to Localhost

Ran into a strange problem with WordPress this morning that to be blunt, freaked me out.

My site was up and working fine but when I tried to login (going to wp-login.php) it redirected to the webserver running on my laptop. I tried a different browser (always the first thing you should try) and it did the same thing. Aaah, what’s going on?

A quick Google search came up with a solution:

Changing the Site URL from WordPress Codex

I used the second method, adding this to my functions.php file:


(do remember to change example.com to your url or it looks really funky and still doesn’t work)

Once you’ve done that, you’ll have access to your backend again. Yay!

Then delete those two lines from the functions.php file.

Now, why did it happen?

Not exactly sure. It may have been a ‘security’ measure by my host to prevent attacks on WordPress admin areas. Some people said a security plugin did it to them, but I don’t have any of those installed.

I know Midphase has had problems with hacking, so maybe it was something they did. Then only the person who had actual ftp access could fix it, but that seems like a very unfriendly way to ‘protect’ sites.