If you have accidentally changed the WordPress URL and site address in the General Settings and is locked out of your WordPress Castle, don’t panic. We can solve it in a minute.
How can I fix it?
In this article, I’m sharing two ways to fix this and regain access to your WordPress site.
Add the following lines to the
wp-config.php file located in the root directory of your WordPress installation.
define('WP_HOME', 'http://yourolddomain.com'); define('WP_SITEURL', 'http://yourolddomain.com');
If you follow this method, you will not be able to update the site url or address in the General Settings section.
If you have access to your database, go to wp-options table and look for
siteurl and home under option_name column. Fortunately, the options comes in the first two rows of the table. Change the URL under option_value column to your old site URL.