0

I'm runnning this command;

sudo -u www-data wp search-replace www.siteurl.com www.newsiteurl.com --recurse-objects --skip-columns=guid --skip-tables=wp_users

From command line: 3.456 replacements From bash-script: 0 replacements

the line in the bash script:

wp search-replace ${OLD_URL} ${NEW_URL} --recurse-objects --skip-columns=guid --skip-tables=wp_users

I've tried trimming the variables, I've tried ${VAR} and $VAR, and even --path=/path/to/site

The output table with details about replacements comes out on both bash and command-line versions. 0 replacements for the bash-script and 3.456 replacements from command line.

  • So when running the bash, you get an output and it just reads 0? Is there any other output? Have you tried adding sudo to the command in the script as well? – kero May 13 at 14:57
  • yep, dropped sudo -u www-data from the question, but it is there. and yes, I get the output, and it lists the same tables, but the results look like this; bash: Success: Made 0 replacements. command-line: Success: Made 3.456 replacements. I've tried to put the whole thing in a variable and running eval $VAR; result: the same, even when i do copy/paste of the command echo $VAR ->copied and then used on command line: 3.456 replacements; eval $VAR in the bash script -> 0 replacements – Leif S. May 13 at 15:37
  • Puh ... I have no idea .. You could create a ticket on their github (or ask directly in the #wp-cli channel on Slack), they can probably help you better than we – kero May 13 at 16:15
  • Actually this is a Bash question and should better be asked on Stack Overflow. But just for clarification, what happens when you put echo ${OLD_URL} and what when you put echo "${OLD_URL}" (with quotation marks) in your script? – leymannx May 13 at 17:57
  • 1
    Tried with and without quotes. same thing. Over to stack overflow. Will try to remember to post solution here when/if I find it :) – Leif S. May 13 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.