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-

    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


    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-
    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-
    The WP-CLI team will assist you.


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

    Thanks in advance.

    Hey. As suggested I opened an issue at Github

    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.

    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)
  • The topic ‘wp-cli search-replace not working with Gutenberg’ is closed to new replies.