Support » Plugins » Hacks » WordPress deletes text_widget settings in wp_options

  • Hi,

    I have a local copy of a wordpress site that I use to develop, on my mac (10.5.8), which is a mirror of a site on the internet. Periodically I dump the sql from the real site and import it locally, so that I can work with the actual content of the site. When doing this, all my text widgets dissappear.

    What happens is that on first load of the local site after the import of new data, the row in wp_options that contains the serialized array for the text widgets, gets reset to a blank text widget, like this:


    I’ve tested the serialized string, and it is not corrupt, meaning that PHP is able to create an array from it. I also recreated the text widgets locally, and looked at the array that was created, and it has the same structure.

    Could the issue have something to do with the keys in the array, that they somehow double already existing keys in wp’s data structure. I just don’t see how that would happen, since also in the database there were other (custom) widgets, that imported just fine, but not the standard text widget.

    So, finally, what is WP looking for when validating these arrays? Where in the code can I find this? Any other ideas?

    Both local and remote site run the same version of wp, 3.0.1.

    Please don’t respond with that I have to copy and paste and redo all the text widgets, I know how to do this, but that is not what I’m asking. I want to have an automated way of doing this, since it is something I do very often for a number of different sites.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have the same problem when I moved my site from one server to another. The text_widget content gets deleted and is replaced with the standard row (a:2:{……..)
    If you, or anyone else has the solution to this, please post =)



    I’m seeing this same behavior. Did you figure out a solution?



    I have not, unfortunately. I stopped looking into it, thinking someone must have solved it before me. If I have time and solve it I’ll post the solution here.



    I believe I just found a solution! The issue seems to be with the copying of the wp_options table.

    This table (wp_options) stores a number of options for the site and configuration settings for plugins. Some of the data in these settings are stored in a serialized array. These arrays not only contain the string, but also contain the length of that string. These need to match for security reasons. So for example, if you change the url from to, you’d also need to change the length setting to the new length of

    For example, this value:


    Would need to change to this value:


    If you look closely, not only did the url change, but so did the number stating it’s length.

    After I manually did this to the values, the text widgets appeared and did not get reset like we had been seeing.

    I am still looking for the definitive guide for copying wp_options widget-related rows from one database to another. The above it very helpful, but I’m trying to figure out the sql query to:

    Find all relevant rows
    Save to text file, download
    import into another database

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress deletes text_widget settings in wp_options’ is closed to new replies.