This topic contains 4 replies, has 3 voices, and was last updated by  Anh Tran 4 weeks, 1 day ago.

  • Creator
    Topic
  • #15683
    Resolved
    jameswreford
    Participant

    Hey everyone!

    I’m not sure if im sharing this issue in the right place, but hitting a bit of a wall!

    I have migrated a wordpress site from one server to another, and getting this weird problem where a ‘group’ set within a ‘tab’ doesnt present the stored data within either the CMS or frontend of my site. It shows in the database though. So the data existed in the old server but disappeared when i imported that database into the new server

    I even tried creating a new entry in the new server, I downloaded the database table for my post_meta and reuploaded it, and again the data exists in my database but disappears from my CMS and front end when uploaded.

    Any support is most appreciated!!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #15686

    Anh Tran
    Keymaster

    Hi,

    Did you change the code for fields when migrating the site? That might be the problem. The structure of the meta box and fields need to be the same in the previous site.

    You can also try to var_dump the value (sometimes you need to unserialize it first if that’s a group), to see the data structure. And verify that with the meta box/fields structure to make sure they match.

    #15688

    jameswreford
    Participant

    Hey,

    Thanks for replying. Yeah its really weird – Like I mentioned, I exported the database and then imported it back into itself, and any new/viewable group entries have completely gone …

    #16189

    DorianFraser Moore
    Participant

    I’ve just hit this exact same issue, and given I’ve taken over the site the person above posted about I thought Id mention it here, in case someone else hits it.

    The field group had been built using the Metabox Builder, but the subsequent code wasn’t in functions.php whis means that it’s relying on the data in wp_posts.

    The config in wp_posts is serialized data and contains the string //dev.host

    When database migrations are run it does a dirty search and replace for all occurrences of //dev.host – that works fine, but in PHP serialised data the length of the value (jn characters) remains unchanged, so the if//dev.host is replaced with //live.host data in wp_posts can no longer be unserialised.

    This would usually throw an error when an invalid value was attempted to be unserialized, but meta-box-builder suppresses those by using @unserialize

    So the solutions are

    1) Make sure anything built with Meta Box Builder are later hard coded into the thems functions.php (this makes sense, but I assume for this site it was left with the builder in place for convenience if requirements changed)
    or
    2) Fix the serialized data in those wp_posts on migration – as migration is a separate tool that would require some post processing and validation

    It’s kind of ott to hard code host names in meta data, to be honest, as it hurts portability. I know this is something that WP do but if you could avoid it would b great.

    I’m going to go for solution 1 moving forward.

    #16236

    Anh Tran
    Keymaster

    @Dorian: your point on serialized data is great. That might be the root cause of the problem.

    If you have to fix the serialized data after migration, you can try WP CLI with the command search-replace (see this docs) or this script. Both can replace the data without breaking the serialization. There are also some plugins on wordpress.org that can do the same job.

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

You must be logged in to reply to this topic.