How to Recover from Failed WordPress Upgrade
Nowadays it seems pretty routine to upgrade WordPress. Go into your WP-Admin control panel, click on upgrade WordPress Automatically and everything is downloaded, installed and upgraded without any issues…Most of the time.
I tried to upgrade a WordPress site the other day, though, and was met by the following error after the upgrade failed.
Fatal Error: Call to undefined function wp() in /home/mark/public_html/wp-blog-header.php on line 14
I could not get back into the WP-Admin control panel anymore and the site was completely down. I’d made a backup of the database before upgrading, but I wanted a simplier fix than starting over. Searching Google for answers proved to be more of a waste of time with lots of questions about the error but not really any solutions.
The key to my particular situation was found by FTPing into the domain and finding most of the wordpress files as zero byte files. In other words, the files were empty. However, the wp-config.php file was intact and still contained links to the database. This was extremely good news.
Sometimes with this particular error, all you have to do is add the following lines to the wp-config.php file to tell WordPress where the files are located. Substituting the term ‘domainname.com’ with the actual domain name.
define('WP_SITEURL', 'http://domainname.com/');
define('WP_HOME', 'http://domainname.com/');
In my particular case, this was not necessary since the wp-config.php file was intact and unchanged.
Steps to Fix Failed Upgrade
Follow these steps to fix this type of situation.
1) Download the latest version of WordPress from WordPress.org to your hard drive
2) Extract it into a WordPress folder
3) Using an FTP program, log into your site and delete the following directories on your WordPress installation:
- wp-admin
- wp-includes
4) Now transfer the wp-admin and wp-includes folder from your hard drive to your site using FTP
5) Transfer all files in the wp-content folder on your hard drive to your site overwriting the files. Do not delete the wp-content folder from your site, just overwrite the files. WP-Content contains your themes, plugins, and more, so you do not want to delete these just fix the basic files in wp-content.
6) Lastly, transfer all the files in the root directory of WordPress on your hard drive to your site. Overwrite any files except wp-config.php.
7) Delete the .maintenance file from the root directory of your site if it exists. Many times a failed WP installation will leave this file and you won’t be able to see your site online until its deleted.
8 ) Now using your web browser visit the wp-admin page of your site. Ex. http://www.domainname.com/wp-admin
9) Log in normally and WordPress may tell you that the database needs to be upgraded. Follow the instructions to do this.
10) Now check your site from a web browser and everything should be back to normal
If its not, please check your wp-config.php file for the correct information for your database including database name, username, password, and the correct path to the database.
Hopefully, after completing these steps your site is operational again!
Filed under: Errors
Like this post? Subscribe to my RSS feed and get loads more!
Dear fastwptips.com,
Thanks a lot for the very informative article. I am a total noob to blogging and wordpress 🙂 Today I tried to update my blog http://www.itscatalyst.com to the latest wordpress version 3.3 and somehow the automatic update was interrupted and my blog was damaged. then i googled a lot and found your blog and followed your guide and recovered my blog. However I accidetely deleted the wp-content folder, though i knew i shouldn’t delete it.
thank you again for your great article.
Hi Fastwptips,
Thanks for writing this post. I had a client’s site go down after trying to update wordpress and got it up and going within 24 hours of going down. I followed your instructions and the site came back up very quickly. Whew!
Theme and plugins were missing, so that took me some time to locate and reinstall. But thanks again for posting those instructions!
Lisa
lisachau.com