Hi,
I need to be able to type multiple values into a text field and for those values to be stored as an array for the field. I can do this with the “Select” field, but that assumes you know in advance what information will be entered in – how can I do this without knowing what data will be entered beforehand? Thanks.
Hey, late response, but try this:
$text_area = get_field("text_area");
$text_area_arr = explode("\n", $text_area);
$text_area_arr = array_map('trim', $text_area_arr);
If you put each value on a new line in the text area, then $text_area_arr should be an array with each new line value. array_map is to get rid of extra white space.