acf_get_field_groups()ACF 5.0.0

acf_get_field_groups

Returns and array of field_groups for the given $filter.

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

Возвращает

Массив.

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

acf_get_field_groups( $filter );
$filter(массив)
An array of args to filter results by.
По умолчанию: array()

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

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

Код acf_get_field_groups() ACF 6.0.4

function acf_get_field_groups( $filter = array() ) {

	// Vars.
	$field_groups = array();

	// Check database.
	$raw_field_groups = acf_get_raw_field_groups();
	if ( $raw_field_groups ) {
		foreach ( $raw_field_groups as $raw_field_group ) {
			$field_groups[] = acf_get_field_group( $raw_field_group['ID'] );
		}
	}

	/**
	 * Filters the $field_groups array.
	 *
	 * @date    12/02/2014
	 * @since   5.0.0
	 *
	 * @param   array $field_groups The array of field_groups.
	 */
	$field_groups = apply_filters( 'acf/load_field_groups', $field_groups );

	// Filter results.
	if ( $filter ) {
		return acf_filter_field_groups( $field_groups, $filter );
	}

	// Return field groups.
	return $field_groups;
}