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…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.