Current theme broken – after server and domain migration

I’m migrating a WordPress install and trying to get down the correct process for doing so.

I’ve tried using the method I thought would work, but it didn’t.

Read More

My files and database are in place, but when I visit the wp-admin the theme manager tells me this – The active theme is broken. Reverting to the default theme.

Unfortunately if you then re-activate it, it work’s but loses all it’s widgets etc.

I’ve been using a search and replace function to change all the instances and options using the old domain with this script – http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

Which is pretty cool.

I’m just replacing

http://domain1.com

with

http://domain2.com

although even running this before I access the site doesn’t seem to stop the problem of the broken theme and thus losing all the widgets.

Anyone know how I can migrate this site without having the ass-ache of losing all the widgets (of which there are way to many to do manually).

Related posts

Leave a Reply

2 comments

  1. The Widget settings are stored in the theme_mods DB entry for your Theme (i.e. {theme-slug}_theme_mods).

    The problem with a database search-and-replace is that theme_mods is a serialized DB entry. So if the new domain name has a different string length than the old domain name, the serialized theme_mods DB entry (as well as any other serialized DB entry that includes a domain name, such as attachment URLs, etc.) will become malformed.

    Ipstenu explains the issue well:

    See some widgets and theme settings store your data and include your URL. This is done with data serialization as well, which means the length of your URL matters. If you changed from ipstenu.org to Lpstenu.org, then you would be perfectly safe doing a total database search/replace of the domain name! But since I’ve proposed changing it to Lipstenu.org, I can’t do that. Any field that counted my domain name would be off by one, and thus invalid, and thus wipe out my settings. Oh and to make it worse? Depending on how you uploaded your media and included it in your site, your postmeta table might also be filled with this.

    So:

    1. Switch back to the default Theme
    2. Go into the database and fix the serialized-array string lengths that have been impacted by the URL domain-name change
    3. Activate your Theme

    Then, your original theme_mods should be restored.