has_sub_field()ACF 1.0.3

This function is used inside a while loop to return either true or false (loop again or stop). When using a repeater or flexible content field, it will loop through the rows until there are none left or a break is detected

No Hooks.

Returns

(true|false).

Usage

has_sub_field( $field_name, $post_id );
$field_name(required)
.
$post_id
.
Default: false

Changelog

Since 1.0.3 Introduced.

has_sub_field() code ACF 6.8.8

function has_sub_field( $field_name, $post_id = false ) {

	// vars
	$r = have_rows( $field_name, $post_id );

	// if has rows, progress through 1 row for the while loop to work
	if ( $r ) {
		the_row();
	}

	// return
	return $r;
}