Wp-cli: search-replace not working with Gutenberg blocks

Created on 15 Oct 2019  路  3Comments  路  Source: wp-cli/wp-cli

Currently we pull the database from a production page to develop environment.
After import we run this commmand to update to local urls
wp search-replace production_url local_url

The problem seems to be the way Gutenberg stores values.
URLs are escaped and become:
https:\/\/www.domain.com

So I ask myself: should wp cli run twice or use two wp search-replace commands?
wp search-replace https://www.production_url https://local_url
wp search-replace https:\/\/www.production_url https:\/\/local_url

search-replace

Most helpful comment

Can confirm. These escaped urls are definitely causing problems for my sync script.

Running the command twice seems to be the best way to go for now, but note that I had to wrap things in double quotes in order for the command to work:

wp search-replace "https:\/\/www.production_url" "https:\/\/local_url"

All 3 comments

Can confirm. These escaped urls are definitely causing problems for my sync script.

Running the command twice seems to be the best way to go for now, but note that I had to wrap things in double quotes in order for the command to work:

wp search-replace "https:\/\/www.production_url" "https:\/\/local_url"

I ran into the same issue. I can confirm that using double quotes around the urls are necessary for the command to work.

Will simple quotes work here too or they need to be double ones?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mirzazeyrek picture mirzazeyrek  路  3Comments

fwaggle picture fwaggle  路  3Comments

yratof picture yratof  路  3Comments

vercotux picture vercotux  路  3Comments

schlessera picture schlessera  路  4Comments