Gaining access to WordPress admin page after making typo in setting for WordPress url.
After two years working with WordPress, I forgot how important it is to double check all entries in WordPress admin and the settings before saving. It’s much too easy to royally screw things up – as I was reminded today.
I was preparing a sponsored post and the advertiser notified me they were having trouble with the remote post and asked me to reauthorize my site.
I did as asked, but in my haste, I inadvertently made an error when typing the WordPress installation url, causing me to be unable to log in to WordPress admin.
In a panic, I did some research online using Google and found several possible solutions.
(Note: For all of these attempts, I saved backups of the original files I was working with.)
The first suggestion was to add a couple of new lines in the wp-config.php file. I won’t give the detailed lines so noone tries it and ends up frustrated. Although I was able to open my admin page, the boxes in the Settings > General window for entering the urls were grayed out and I was unable to make the edit. I went back online and typed in this problem and found another forum where they said to not edit the wp-config.php file as that results in grayed out, uneditable input boxes. I removed the lines I had added and resaved the file.
The next suggestion I found was to add a couple of lines to the functions.php file of the installed and active theme. I was thrilled to find that it worked and I was able to edit the urls.
So, if you’re having the same problem, here’s what you should do.
Right after the first “<?php” line at the very top of the “functions.php” file, enter:
Insert your own urls in place of “example.com/blog.” Make sure they are the correct urls, because they can be different if your site has its own domain. If this is the case, enter the domain url as the ‘site url’ and enter the actual path on the server to your WordPress installation. It usually looks like “http://example.com/blog” listing the subdirectories leading to the installation.
If you don’t have a functions.php file, open a text editor and create a new file, inserting the following text and then saving, naming it “functions.php” and editing the urls in the string as indicated above.
Using FTP, upload the new or amended “functions.php” file to the active theme’s directory.
Open a new window and try to log in to your admin page. It should open fine now. Proceed to Settings > General, and enter the correct urls in the input boxes. As long as nothing’s been done to “wp-config.php”, this should be possible.
Once the correction(s) are made and saved, and if all is working well, make absolutely sure to return to the window with the “functions.php” file and remove the additional lines, or the entire new file if you created it. THIS IS VERY IMPORTANT.
Leave a Reply
Modify or customize a theme, convert a theme to another basic site or CMS, or start from scratch on your own? Are you not fluent in code? I create themes using Artisteer 4 software - very simple and user friendly. If you would like the original design file, just email me using the sidebar link, provide your email, and I will forward the file to you at no charge.