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

Хуков нет.

Возвращает

(true|false).

Использование

has_sub_field( $field_name, $post_id );
$field_name (обязательный)
-
$post_id **
-
По умолчанию: false

Список изменений

С версии 1.0.3 Введена.

Код has_sub_field() ACF 6.0.4

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;

}