acf_get_field_count()ACF 5.0.0

acf_get_field_count

Return the number of fields for the given field group.

Хуки из функции

Возвращает

int.

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

acf_get_field_count( $parent );
$parent(массив) (обязательный)
The field group or field array.

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

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

Код acf_get_field_count() ACF 6.0.4

function acf_get_field_count( $parent ) {

	// Check local fields first.
	if ( acf_have_local_fields( $parent['key'] ) ) {
		$raw_fields = acf_get_local_fields( $parent['key'] );

		// Then check database.
	} else {
		$raw_fields = acf_get_raw_fields( $parent['ID'] );
	}

	/**
	 * Filters the counted number of fields.
	 *
	 * @date    12/02/2014
	 * @since   5.0.0
	 *
	 * @param   int $count The number of fields.
	  * @param  array $parent The field group or field array.
	 */
	return apply_filters( 'acf/get_field_count', count( $raw_fields ), $parent );
}