I want to transform wp_postmeta data of an old plugin to Advanced Custom Fields ACF (Pro, but that's not the point). The old plugin saved ALL data in ONE meta_value (separated with ||
and \n
) while ACF would use multiple values:
Old Plugin data in MySQL:
meta_id
post_id 1000
meta_key "oldplugname"
meta_value "data1||url1\ndata2||url2\ndata3||url3\n"
As you can see, I have zero to multiple data<->url per post_id
How would I transform this to an ACF Pro Repeater Field (let's call this field "repeater")?
When trying to build sth. similar with repeater i'd get with 3 data-url :
meta_key -> meta_value
repeaterfield -> 3
_repeaterfield -> field_5cdbf84150b2a
repeaterfield_0_data -> aaa
_repeaterfield_0_data -> field_5cdbf84f50b2b
repeaterfield_0_url -> http://urlforaaa.com
_repeaterfield_0_url -> field_5cdbf84f50b2c
repeaterfield_1_data -> bbb
_repeaterfield_1_data -> field_5cdbf84f50b2b
repeaterfield_1_url -> http://urlforbbb.com
_repeaterfield_1_url -> field_5cdbf84f50b2c
repeaterfield_2_data -> ccc
_repeaterfield_2_data -> field_5cdbf84f50b2b
repeaterfield_2_url -> http://urlforccc.com
_repeaterfield_2_url -> field_5cdbf84f50b2c
So any idea, how to transform that old data over from "oldplugin" to ACF?