acf_get_term_title()ACF 5.0.0

acf_get_term_title

Returns the title for this term object.

Хуков нет.

Возвращает

Строку.

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

acf_get_term_title( $term );
$term(объект) (обязательный)
The WP_Term object.

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

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

Код acf_get_term_title() ACF 6.0.4

function acf_get_term_title( $term ) {
	$title = $term->name;

	// Allow for empty name.
	if ( $title === '' ) {
		$title = __( '(no title)', 'acf' );
	}

	// Prepend ancestors indentation.
	if ( is_taxonomy_hierarchical( $term->taxonomy ) ) {
		$ancestors = get_ancestors( $term->term_id, $term->taxonomy );
		$title     = str_repeat( '- ', count( $ancestors ) ) . $title;
	}

	return $title;
}