Support

Account

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

  • Hi @robmehew

    Could you try using WordPress sanitize_text_field() function to do the sanitation just to make sure there’s nothing outside of ACF giving you this “error”. https://codex.wordpress.org/Function_Reference/sanitize_text_field


    @tadywankenobi
    that is weird indeed. So the variable $new is definitely an array all the time? You haven’t declared $new somewhere else as well or use the same field_name for a different meta field on the same post? And the value you’ve set for the checkbox is “set”?

    Also, you can try instead of a checkbox field to use a true/false field since that’s pretty much what you want.. It’ll return either true or false (1/0 .. duh 😉 ).