acf_get_post_type_label()ACF 5.4.0

acf_get_post_type_label

This function will return a pretty label for a specific post_type

Хуков нет.

Возвращает

(Строку).

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

acf_get_post_type_label( $post_type );
$post_type (обязательный)
-

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

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

Код acf_get_post_type_label() ACF 6.0.4

function acf_get_post_type_label( $post_type ) {

	// vars
	$label = $post_type;

	// check that object exists
	// - case exists when importing field group from another install and post type does not exist
	if ( post_type_exists( $post_type ) ) {

		$obj   = get_post_type_object( $post_type );
		$label = $obj->labels->singular_name;

	}

	// return
	return $label;

}