• Resolved nunziorash

    (@nunziorash)


    Hi, I have been using cmb2 for a long time and I find it amazing.
    I have a single problem, I create the site in localhost and fill in the personalized changes.
    When I publish the site on the domain custom fields are no longer populated. They appear in the database.

    Why? Can you help me please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    It sounds like you’re ending up with serialized data stored in some of the fields. Depending on how you’re updating the URLs, that may be causing the serialized data to become invalid and thus get dropped by PHP.

    What method are you using to update those values? Some sort of MySQL find/replace? Export, open in text editor, find all, replace, save? Something else.

    Thread Starter nunziorash

    (@nunziorash)

    I first do an
    UPDATE wp_posts SET guid = replace(guid, ‘https://www.oldurl’,’https://www.newurl’);
    UPDATE wp_posts SET post_content = replace(post_content, ‘https://www.oldurl’, ‘https://www.newurl’);
    UPDATE wp_postmeta SET meta_value = replace(meta_value,’https://www.oldurl’,’https://www.newurl’);

    Then I look for the old url in the database and replace it.

    And then I use better search and replace plugin.

    In the database then the old url localhost no longer appears anywhere.

    But when I go to metabox then, I find the fields empty.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    This is probably the part that’s throwing things off for you:

    UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://www.oldurl','https://www.newurl');
    

    Because post meta can be serialized and likely is the case here.

    Realistically, I would recommend making use of Better Search and Replace for all aspects of this domain change, as I know that plugin handles serialization for you, and shouldn’t cause the data loss.

    Thread Starter nunziorash

    (@nunziorash)

    OK, I will try.

    At the next site I do I try and if there is still the problem I will write to you

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds good.

    Thread Starter nunziorash

    (@nunziorash)

    I confirm.
    If the replacement I do only do the plugin better search and replace, the metaboxes remain compiled.

    Thanks

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Awesome, thanks for the followup confirmation.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change site’ is closed to new replies.