Support

Account

Home Forums Add-ons Repeater Field have_rows return value

Helping

have_rows return value

  • According to this documentation, the return value for have_rows() is bool. So if a row exists, it returns true. Which totally makes sense. In case if there aren’t any rows, it’s suppose to return false right?

    However, that is not the case. It returns an empty string if there aren’t any rows.I had to exit early from the code. So I found out that only the following works.

    if ( '' === have_rows( 'event_dates', $published_event ) ) {
    	return;
    }

    Thoughts?

  • if (!have_rows('event_dates'))
    should do the same thing.

    The function returns a truthy or falsey value.

    I your case it is likely returning an empty string because the repeater was never set to any value, but that is just a guess.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.