# rest_get_queried_resource_route()

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

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

## Сигнатура

```php
rest_get_queried_resource_route(): string
```

## Описание

Получает REST-маршрут для текущего запрошенного объекта.

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

`string`

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

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

```php
function rest_get_queried_resource_route() {
	if ( is_singular() ) {
		$route = rest_get_route_for_post( get_queried_object() );
	} elseif ( is_category() || is_tag() || is_tax() ) {
		$route = rest_get_route_for_term( get_queried_object() );
	} elseif ( is_author() ) {
		$route = '/wp/v2/users/' . get_queried_object_id();
	} else {
		$route = '';
	}

	/**
	 * Filters the REST route for the currently queried object.
	 *
	 * @since 5.5.0
	 *
	 * @param string $link The route with a leading slash, or an empty string.
	 */
	return apply_filters( 'rest_queried_resource_route', $route );
}
```

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

- 5.5.0 — Introduced.

## Связанные

Использует: [`rest_get_route_for_post`](https://chugunov.pro/api-wordpress/functions/rest_get_route_for_post/), [`rest_get_route_for_term`](https://chugunov.pro/api-wordpress/functions/rest_get_route_for_term/), [`is_singular`](https://chugunov.pro/api-wordpress/functions/is_singular/), [`is_category`](https://chugunov.pro/api-wordpress/functions/is_category/), [`is_tag`](https://chugunov.pro/api-wordpress/functions/is_tag/), [`is_tax`](https://chugunov.pro/api-wordpress/functions/is_tax/), [`is_author`](https://chugunov.pro/api-wordpress/functions/is_author/), [`get_queried_object`](https://chugunov.pro/api-wordpress/functions/get_queried_object/), [`get_queried_object_id`](https://chugunov.pro/api-wordpress/functions/get_queried_object_id/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`rest_output_link_wp_head`](https://chugunov.pro/api-wordpress/functions/rest_output_link_wp_head/), [`rest_output_link_header`](https://chugunov.pro/api-wordpress/functions/rest_output_link_header/).

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