Home › Forums › ACF PRO › if (have_rows()) not working › Reply To: if (have_rows()) not working
Hi @dunkel My workaround is this:
In the Field Group I’m using I NOW have the “Minimum Rows” set to zero, so that NO rows are created by default…..when I’m creating a post and I want to ADD rows, then I use the Add Row Button. Often times I don’t.
If you leave the “Minimum Rows” setting to it’s default (which I think, at least in my version, is 1) then a single row is created for every Post to which the Field Group is applied – this single empty row is what creates the problem and setting the Minimum Rows to 0 fixes that – no row is created hence there is not a ‘1’ applied to the Post in the database (if you have a single row created by a 1 in the field group’s minimum rows setting, even if it’s empty, it appears in the database and if(have_rows) sees it and counts it).
By changing that to zero, if you’re using the if(have_rows) you will truly have no rows and the code works…..it only finds rows that you manually added.
I hope this makes sense!
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.