I’m working on a site for a talent agency. The developer of a separate private database management system is able to provide an API plugin which imports the talent into WordPress.
The plugin adds each person as a custom post and adds the various meta data as custom fields which are, on the whole, text, numbers and boolean.
However a few of the fields arrive as comma-separated strings.
I’m trying to mirror the fields on the post edit screen so, following import, my client can make further changes to the post.
So, my question is; are any ACF field types stored as comma separated strings? If not, is there a way I can turn a comma separated string into a repeater or similar before it is displayed on the edit screen?
There are no fields in ACF that store comma separated strings.
You might be able to do this using 2 different “fields”. After import you could convert the comma separated string into another field type like a repeater, but there’s nothing in ACF that will do this for you.
https://www.advancedcustomfields.com/resources/acf-save_post/
https://www.advancedcustomfields.com/resources/acf-update_value/
https://www.advancedcustomfields.com/resources/update_field/
Thanks for this John, to accompany your helpful links I’ve created a PHP function which transforms the comma separated string into an array which matches the format of a repeater. The gist and a more detailed explanation are here:
Comma separated string into ACF compatible multidimensional array
Posting in case it helps anyone else.