# rest_get_route_for_taxonomy_items()

URL: https://chugunov.pro/api-wordpress/functions/rest_get_route_for_taxonomy_items/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 5.9.0.

## Сигнатура

```php
rest_get_route_for_taxonomy_items( string $taxonomy ): string
```

## Описание

Возвращает маршрут REST API для таксономии.

## Параметры

- `$taxonomy` `string` — обязательный. Имя таксономии.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-includes/rest-api.php:3288`

```php
function rest_get_route_for_taxonomy_items( $taxonomy ) {
	$taxonomy = get_taxonomy( $taxonomy );
	if ( ! $taxonomy ) {
		return '';
	}

	if ( ! $taxonomy->show_in_rest ) {
		return '';
	}

	$namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2';
	$rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
	$route     = sprintf( '/%s/%s', $namespace, $rest_base );

	/**
	 * Filters the REST API route for a taxonomy.
	 *
	 * @since 5.9.0
	 *
	 * @param string      $route    The route path.
	 * @param WP_Taxonomy $taxonomy The taxonomy object.
	 */
	return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy );
}
```

## История изменений

- 5.9.0 — Introduced.

## Связанные

Использует: [`get_taxonomy`](https://chugunov.pro/api-wordpress/functions/get_taxonomy/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `WP_REST_Taxonomies_Controller::prepare_links`, [`rest_get_route_for_term`](https://chugunov.pro/api-wordpress/functions/rest_get_route_for_term/), `WP_REST_Terms_Controller::prepare_links`, `WP_REST_Terms_Controller::get_items`, `WP_REST_Posts_Controller::prepare_links`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/rest_get_route_for_taxonomy_items/
