Home › Forums › Add-ons › Repeater Field › Know the number of repeater rows before while statement › Reply To: Know the number of repeater rows before while statement
You say (not nested repeater)
, are you working with a nested repeater?
One line of code is the solution. When you use get_field()
for a repeater it returns an array. Each row of the repeater is an element of the array. count()
gives the number of rows in the array.
If you’re getting zero for a repeater that has rows then something else is going on preventing you from correctly getting the field.
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.