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
etc...
The URLs are stored in an ACF URL custom field. Is this going to cause any serialisation issues?
URL fields are stored as simple text values and not serialized.
Hi John,
Thanks for confirming. One more thing, is this the correct table to use in my command: –include-columns=post_content
many thanks again
ACF values are stored in the _postmeta, table,
or in _usermeta, _termmeta, _commentmeta or _options when using fields on those object types.
sorry for being a newbie, is there a difference between _postmeta and wp_postmeta ?
so in my command instead of post_content I will just use _postmeta ?
No
wp_ is the default table prefix. Sometimes this is changed. When you see _postmeta it means the postmeta table with whatever prefixe is set for your site.