wp-cli search-replace not finding all instances on first run
-
I’m using wpcli in a script to move staging sites to live when the time comes and it works great. I’ve been using the same process for several years now and never seen anything like this issue before.
This only happens on 1 site (I’ve changed the domain in the commands below but all other info is copied).
On this particular site, I always have to run the search-replace command 2 times to replace all references. Here is the output for the 2 runs (always the same exactly).
wp --skip-plugins --skip-themes search-replace '//staging.domain.com' '//domain.com' --all-tables 2>/dev/null | grep Success Success: Made 43796 replacements. wp --skip-plugins --skip-themes search-replace '//staging.domain.com' '//domain.com' --all-tables 2>/dev/null | grep Success Success: Made 761 replacements.
I’ve tried running this test in multiple ways.
– with or without “–skip-plugins –skip-themes”
– with all plugins disabled including drop-ins and must-use
– using a default theme
– using –preciseAdditionally, there are no database triggers setup in this database and the WP core files pass validation.
Does anyone have an idea why it would not replace all of the domain references on this one site on the first pass?
Another odd thing about this issue is that if I use the –regex option, then it does replace all of the references. I’m not using regex in the search though so I’m not sure why it would be needed and it takes forever so it’s not really a solution. But I still have no idea why adding –regex to the command would make any difference, other than maybe a bug in wpcli.
Thanks in advance!
- The topic ‘wp-cli search-replace not finding all instances on first run’ is closed to new replies.