Theme Options Lost When Moving to New URL

Changing the URL of a WordPress site is well documented here:

http://codex.wordpress.org/Changing_The_Site_URL

However, the documentation does not address an issue in which theme options such as the header image and background image are lost.

There is an excellent explanation of what is causing this in the WordPress forums:

http://wordpress.org/support/topic/theme-delicate-theme-options-lost-when-moving-to-new-domain

To paraphrase Sayontan Sinha’s comment, if the theme uses the WP Settings API to store options in the database, the options will get encoded using a type:length:value format. If the new URL differs in length from the old URL, the length value will need to reflect the accurate character length of the value. To correct the theme settings, I had to export the wp_options database table and search each instance of the new URL, then copy the value string into Word to get the character count and update the length. Re-importing wp_options restored the theme settings.