Friday, April 24, 2015

Gave wordpress home page the wrong name and can't login

If you are redirected to other url after you login to wordpress admin  so you can't login and your site is not working, then you probabily have changed wordpress home url or site url in wordpress setting.


solution:

1.Add these two lines to your theme's functions.php , immediately after the initial "<?php" line.

update_option('siteurl','http://example.com');
update_option('home','http://example.com');

Use your own URL instead of example.com, obviously.

2. Load the login or admin page a couple of times. The site should come back up.
Important! Do not leave those lines in the functions.php file. Remove them after the site is up and running again.