Hello!
I’d like to print out multiple values from a checkbox field, which with the_sub_field('field_name');
works fine to achieve: value1, value2, value3
However I need to remove the commas from the string, and cannot use str_replace() to achieve: value1 value2 value3
When using echo implode(', ', get_field('field_name'));
WordPress throws an error on implode & invalid arguments. The checkbox is inside a flexible content field and a repeater field. Is there an alternate way to stripping out those commas?
Thanks!
Hi @87c
To get a value for a sub field, please us the get_sub_field function.
This will solve your issue.
ALso, please allow an exception in your code to allow for the returned value to be empty. You should wrap your implode code around an if statement to prevent PHP errors.
Thanks
E