Support » Developing with WordPress » wp-cli search-replace not working with Gutenberg

  • Currently we pull the database from the production page to develop locally.
    After import we run this commmand to update to local urls
    “wp search-replace production_url loclal_url”

    For most of the content, it works but not for Gutenberg blocks.
    They stay the same, containing the production_url also locally.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi,
    I think you missed something.
    Did you try this doc- https://developer.wordpress.org/cli/commands/search-replace/

    Hi Fahim, what exactly did I miss?

    By default, the command uses tables registered to the $wpdb object. On multisite, this will just be the tables for the current site unless –network is specified.

    I wouldn’t assume that Gutenberg stores its values somewhere else then the connected tables.

    I hope another expert will assist you.

    Moderator bcworkz

    (@bcworkz)

    I don’t know how wp-cli search and replace is supposed to work. In any case it sounds like it’s not meeting your needs. When updating moved/copied DB URL domains, it’s recommended a plugin like Better Search and Replace be used, principally because it correctly alters serialized data which most search/replace tools would fail to do correctly. It’ll certainly reach into block data and update as requested.

    Right, I was thinking about search and replace plugin.
    Install and check- https://wordpress.org/plugins/search/Search+Replace/
    If not work, maybe have to export the DB and replace text from the code editor.

    Honestly, not a friend of installing plugins for every purpose.
    I understand that some focus on special features but this one is crucial.
    Gutenberg becomes WordPress standard and so does wp cli. It should work as intended and not leave out serialized data (or at least mention it in the release/function notes).

    Thanks for both your feedbacks. Still hope it will be supported in a future version.

    You can ask here- https://github.com/wp-cli/wp-cli/issues
    The WP-CLI team will assist you.

    Fahim Murshed

    (@fahimmurshed)

    Hi,

    Did you get any solution? Let me know if you get anything because personally I am using WP-CLI.

    Thanks in advance.

    phloo

    (@phloo)

    Hey. As suggested I opened an issue at Github
    https://github.com/wp-cli/wp-cli/issues/5293

    No response at all. I am wondering that no one else is reporting the same problem.
    Found out that Gutenberg content is saved as escaped html (why though?) and the search pattern won’t match.

    Fahim Murshed

    (@fahimmurshed)

    Don’t worry. I’ll share this post and github issue on the slack channel #cli

    I hope, someone will assist you

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