acf_get_taxonomies()ACF 5.0.0

acf_get_taxonomies

Returns an array of taxonomy names.

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

Возвращает

Массив. An array of taxonomy names.

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

acf_get_taxonomies( $args );
$args(массив)
An array of args used in the get_taxonomies() function.
По умолчанию: array()

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

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

Код acf_get_taxonomies() ACF 6.0.4

function acf_get_taxonomies( $args = array() ) {

	// vars
	$taxonomies = array();

	// get taxonomy objects
	$objects = get_taxonomies( $args, 'objects' );

	// loop
	foreach ( $objects as $i => $object ) {

		// bail early if is builtin (WP) private post type
		// - nav_menu_item, revision, customize_changeset, etc
		if ( $object->_builtin && ! $object->public ) {
			continue;
		}

		// append
		$taxonomies[] = $i;
	}

	// custom post_type arg which does not yet exist in core
	if ( isset( $args['post_type'] ) ) {
		$taxonomies = acf_get_taxonomies_for_post_type( $args['post_type'] );
	}

	// filter
	$taxonomies = apply_filters( 'acf/get_taxonomies', $taxonomies, $args );

	// return
	return $taxonomies;
}