Support

Account

Home Forums General Issues Error – count(): Parameter must be an array

Unread

Error – count(): Parameter must be an array

  • Hi,

    I am using Sage 9, WPML and ACF for a site.

    I’m trying to get the total number of post objects for a loop

    @php $totalrows = count(get_field('team_contact')) @endphp

    But I get this error:
    count(): Parameter must be an array or an object that implements Countable

    Strangely, I get there error only when I switch to the english version of my site managed by WPML. My ACF is up to date.

    Also when I wrap a conditionnal is_array() on my code, I get nothing, which indicates me that somehow “get_field(‘team_contact’)” is not considered an array.

    How can I return the total number of post objects (or rows-for repeater field) without getting this php error?

    Thanks a lot.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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.