• Hello, I have a working development site which I’m trying to replace my working site with (both WP 7.02). This dev site has a copy of the database (of course), but uses an upgrade to the same theme (the theme is no longer supported and didn’t provide an auto-upgrade option). The dev site works fine. Now I’m doing what I’ve always done to migrate the dev site back to the working site: copy the WP files, and use the new database but suitably modified so that all references to dev.X.com are replaced by X.com, etc.. I’ve done this kind of procedure many times successfully. But this time I find that the entry for theme_mods(followed by _theme name) in the wp_options table is getting overwritten as soon as I load the site. It’s replaced with a short string which I imagine are defaults. All my theme option selections have disappeared. If I manually change the DB entry back to what it is in my dev DB, the same thing happens again.

    Does anyone know whether WP or my theme might be doing this, and most importantly how to prevent it?

    Thanks

    • This topic was modified 2 weeks, 5 days ago by timbergski.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter timbergski

    (@timbergski)

    In case it helps others, I’ve found that my naive approach to editing the database (export to .mysql file, find/replace strings like dev.X.com -> X.com, then import to a new database), breaks the PHP serialisation format of the affected data, since string lengths change. See https://stackoverflow.com/questions/56019599/wp-customizer-theme-settings-disapearing-after-wp-database-restore-migrate. I’m in the process of doing the string replacements intelligently. Will report here if it doesn’t work.

    Thread Starter timbergski

    (@timbergski)

    Thanks again. Here’s the command I’m using (I’ve replaced private domain name etc):

    wp --path=/home/account-name/public_html/dev.example.com search-replace "dev2.example.com" "example.com" --all-tables-with-prefix --skip-columns=guid --export=/home/account-name/SEARCH-REPLACE.sql

    It reports “Success: Made 1093 replacements and exported to <the export file I supplied>”. It also reports some skipped entries due to a theme-specific PHP class, but I looked and those are few and don’t matter (it’s an unused theme).

    But when I look in SEARCH-REPLACE.sql, there are still many instances of dev2.example.com, including copious URLs that wouldn’t work if I archived or deleted my development image.

    wp simply hasn’t worked. In addition, the theme I’m using has stored a few absolute paths in the DB which need to be globally replaced, but wp doesn’t seem to allow multiple search/replace pairs in a single command.

    What am I missing? Has anyone found this useful?

    Thread Starter timbergski

    (@timbergski)

    BTW, before I used the wp CLI I tried the “All-in-One WP Migration and Backup” plugin – again, exporting to a file. That didn’t work either!

    Thread Starter timbergski

    (@timbergski)

    First, in case anyone is wondering, someone was helping me in this thread (I thank them at one point) but all their posts have disappeared!

    Second, I fixed this problem. I could see programatically how to take a DB dump of the working development site and transform it for the production (live) domain. I got Claude to write the code for me, and it works (after wrangling Claude away from doing stupid/over-complicated things). If anyone else has this problem, get in touch.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.