ACF Multi select or Select box only return "Array" as value

Hello,

I am facing a weird issue.
I am trying to return a VALUE from a Select list or a select box with multiple selectable options.
It seems that the value returned when there is multiple selected element is “ARRAY” and not the value or label of those elements.

Let’s say i have a Select Box named CHOICES in an option field.
with
CHOICE 1
CHOICE 2
CHOICE 3

I would like to select Choice 1 and Choice 2.
When i do,
If i fill this string in a text element :

{{ acf.option_field({“field”:“choices”}) }}
The value returned is ARRAY instead of CHOICE 1 and CHOICE 2

This prevent me from building condition based element.
Any idea how to fix that ?

thank you very much.
Best regards

For your condition you probably want to use the in statement. For instances if I have red, blue, green as my multi select options. If blue is selected it will return 1 when used in an output like this. And in your condition you could check based on that. I’m assuming you have the return format as Value based on what you have said. Using Both (Array) return format would need something different. Let us know if this helps.

{{ 'blue' in acf.post_field({"field":"multi_select"}) }}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.