Support

Account

Home Forums General Issues get_field returns array, field type is text. Reply To: get_field returns array, field type is text.

  • I’m having the same issue. I have an option on a link, a checkbox to say, “Open in new window”. When it’s checked, I use:

    $new = get_field("new_window");

    to return whether this is set or not. If I do:

    if(in_array('set', $new))

    I get an error telling me second variable in in_array must be array

    If I do

    if(strpos($new, 'set') !== false)

    I get an error telling me first variable must be a string. PHP eh?!

    For whatever reason, I can’t do:

    if($new == 'set')

    as this always returns false. A var_dump of the $new variable shows it is indeed an array.

    Any ideas?

    Edited: Actually, I should clarify, these are PHP notices, not errors. I’m not too worried, but I would like to resolve. If the answer is “Because, PHP” well then, that’s it…