I will be using this command with WP-CLI to batch change about 1,000 URLs.

while IFS=, read orig new; do wp --dry-run --skip-themes --skip-plugins search-replace "$orig" "$new" wp_posts --include-columns=post_content --verbose; done < example.csv

The contents of the .csv is two columns with the old and new strings:

https://www.oldurl1 https://www.newurl1 
https://www.oldurl2 https://www.newurl2
https://www.oldurl3 https://www.newurl3

The URLs are stored in an ACF custom field. Is this going to cause any serialisation issues?

  • note that while WP CLI is on topic, ACF and other 3rd party plugins are not and are outside the scope of this stack, this isn't a place to get help with ACF
    – Tom J Nowell
    Apr 6 at 10:10

1 Answer 1


No because you're running the command on the posts table, and only on the content column, but ACF fields aka post meta are stored in the post meta table, not the content column of the posts table so no search replacing is occurring.

You can tell WP CLI to perform the search replace with PHP to avoid PHP serialisation issues using --precise as specified in the official documentation:


Note that while this might avoid PHP serialisation/deserialisation problems, it's not a guarantee that ACF will behave itself, you would need to ask in an ACF community or try it out to know for certain ( 3rd party plugin questions are offtopic here )

  • thanks, I did ask and you are right about postmeta table. The URLs are stored in a text field so there won't be any serialisation issues.
    – JoaMika
    Apr 7 at 11:29
  • I mention asking because I've encountered situations in the past were hashed URLs are stored, which means they're missed by a search replace, likewise even singular fields can sometimes be serialised. Take a backup before you do the search replace and try it out
    – Tom J Nowell
    Apr 7 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.