Web Design and Development
If you’ve found this article, it is probably because you made a mistake when updating your WordPress url settings, and now need a solution for reversing your changes. And the problem that you have likely encountered is that the WordPress admin area is inaccessible. So you can no longer make changes via the WordPress interface.
Fortunately, if you can edit and upload files, or have direct database access, you can easily reverse the changes.
The simplest way to reverse the changes it to edit your theme’s functions.php file.
Each theme generally has a functions.php file. It will be located in your active theme’s directory at:root -> wp-content - > themes -> [theme name] - > functions.php
Once you’ve found this file, you will need to edit it by adding the following code at the very top of the file, but within the opening
If your theme does not have a functions.php file, you will need to create one. Inside of it place the following code:
Be sure to edit the code to reflect the url settings for your blog, and then upload this file to your theme’s directory. Now attempt to access your admin area. Note: You might need to reload or refresh the page a few times. When you have successfully loaded the website, edit the functions file again to REMOVE those lines that you added. Now your settings should be fixed.
If, for some reason, the above method does not work, you can accomplish the same fix by directly editing the database.
Once you have access to the database, either via phpMyAdmin or through some other database utility tool, you will need to run the following query.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-url.com', 'http://www.new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Note: You will need to update this code to reflect the url for your website. Additionally, if your website uses something other than the default database table prefix, you will need to update the
to reflect the name of your options table.
And that’s all. Your settings should now be fixed.
The reason why it is so easy to mess up your settings is because the difference between WordPress Address and Blog Address is not well explained. The WordPress Address is the location where WordPress is installed. Or in other words, it is the directory where you will find the WordPress files. On the other hand, the Blog Address is the location where the home page of the blog will be.
In most cases, the WordPress Address is the same as the Blog Address. However sometimes, such as if you want to keep WordPress files separate from other files, you might place WordPress files in their own directory. For additional information on this topic, visit the WordPress documentation on Giving WordPress Its Own Directory.Tags: blogs, WordPress