Monday, October 06, 2008

Gotcha Of The Day: Can't Log In After Upgrading Wordpress

Upgrading Wordpress is basically a simple 3 step process. I've done this a handful of times before, so I didn't expect tonight's upgrade on a client's site to be any more eventful than those other times.

I did step zero and made a backup. I did step two and uploaded the files. And then I went to do step three, that is visit: http://www.mysite.com/wp-admin/upgrade.php, yet I was always bounced over to:

http://www.mysite.com/wp-login.php

I re-checked my work,and re-uploaded the files. No change - I wasn't able to complete the upgrade. Also, attempts to login to the back end kicked me back to the login screen again.

Houston, we have a problem.

To diagnose the problem I added in print statements in the Wordpress code till I found the block that was misbehaving (man I love open source software!). Turned out, it was the process of reading in the plugin files were kicking me back to the login page. Apparently one of the plugins the site used wasn't compatible with the latest version of Wordpress.

This of course reminded me of something I had read in step 0 of the instructions:

Deactivate your plugins. A plugin might not be compatible with the new version, so it's nice to check for new versions of them and deactivate any that may cause problems. You can reactivate plugins one-by-one after the upgrade.

D'oh! Apparently I should have actually done all of step 0, not just the parts I thought were important.

Now I had a bit of a pickle - I couldn't finish the upgrade of Wordpress, and I couldn't log in to deactivate the plugins, so that I could finish upgrading Wordpress.

I solved this one by connecting to the database and running the following SQL. It clears out all the active plugins from the database:

  UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

With the incompatible plugins out of the way, I was able to complete the upgrade process, log in and even upgrade and reactivate the needed plugins. Life was good again.

3 comments:

  1. thanks for the tip, I'll make sure to keep in mind to do all of step 0. Also have you tried the Wordpress Automatic Upgrade plugin? I'm pretty sure it takes care of all of step 0.

    ReplyDelete
  2. Thanks Nick - I'll have to try that plugin next time!

    -Ben

    ReplyDelete
  3. Anonymous9:28 AM

    I had this problem and so i renamed the plugins folder to something else, logged in ! and then renamed the plugins folder back to plugins, then I was asked to upgrade the database. and all was well after that - no deleting anything!

    ReplyDelete