acf_get_choice_from_term()ACF 5.7.6

acf_get_choice_from_term

Returns an array containing the id and text for this item.

Хуков нет.

Возвращает

Массив.

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

acf_get_choice_from_term( $term, $format );
$term (обязательный)
-
$format(строка)
The value format (term_id, slug)
По умолчанию: 'term_id'

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

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

Код acf_get_choice_from_term() ACF 6.0.4

function acf_get_choice_from_term( $term, $format = 'term_id' ) {

	// vars
	$id   = $term->term_id;
	$text = acf_get_term_title( $term );

	// return format
	if ( $format == 'slug' ) {
		$id = acf_encode_term( $term );
	}

	// return
	return array(
		'id'   => $id,
		'text' => $text,
	);
}