Support » Fixing WordPress » WP_Option theme_mods_XX being overwritten

  • Resolved pacificnewmedia

    (@pacificnewmedia)


    This could be a problem with the theme, but I have no idea why or where it would be checking and overwriting this, as the ‘customize’ feature is built into the wordpress core.

    The issue occurs when I am moving a development site from a subdirectory (WPSubdirectory below) to a root directory (ROOT below).

    1. This morning I completely duplicated the a WPSubdirectory site files and database. I downloaded the database and manually did a search and replace on the URL to prepare for the transfer.

    2. Then, I created a new database and uploaded the database to it

    3. I edited the config file of the WPSubdirectory version of the site to point to this new database.
    Now, with a brand new database and copy of the files, I did the transfer.

    4. I moved all of the ROOT files into a newly created ‘oldsite’ directory, and the WPSubdirectory files into the ROOT directory

    5. Now, when I hit the ROOT address, I am presented with the new site version. However, there are custom theme settings missing, including navigation menu positions, some custom CSS settings, and the logo image etc.

    6. I narrowed it down to a spot in the database where the theme settings are stored, in the wp_options table, there is a value called ‘theme_mods_coastal’. It has what looks like a default:

    a:9:{s:18:”custom_css_post_id”;i:-1}

    7. So I took the custom settings from the WPSubdirectory version of the site, and pasted them into the database.

    8. However, as soon as I visited the website, it still looked the same. I looked back in the database, and it is overwritten again to no settings

    a:9:{s:18:”custom_css_post_id”;i:-1}

    I tried with the version of WP and plugins that it originally had, and I tried updating the wordpress version and all plugins and themes that had updates and it still gave the same problem.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • cspiliakos

    (@cspiliakos)

    Hi @pacificnewmedia,

    I would suggest duplicating the installation and transferring it using the Duplicator plugin found here: Duplicator.

    If you need more help, please don’t hesitate to reply here!

    Cheers!

    I managed to solve the problem – it came down to the theme_mods_xx field.
    It is a serialized array, and my database search&replace was modifying the serialized array, which caused it to be invalid.

    By unserializing, and then editing the WP URL to the new WP URL, and then reserializing, the issue was solved.

    Thanks for the plugin recommendation, if it handles the serialized arrays this way then it would also be a solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.