rest_route_data хук-фильтрWP 4.4.0

Filters the publicly-visible data for REST API routes.

This data is exposed on indexes and can be used by clients or developers to investigate the site and find out how to use it. It acts as a form of self-documentation.

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

add_filter( 'rest_route_data', 'wp_kama_rest_route_data_filter', 10, 2 );

/**
 * Function for `rest_route_data` filter-hook.
 * 
 * @param array[] $available Route data to expose in indexes, keyed by route.
 * @param array   $routes    Internal route data as an associative array.
 *
 * @return array[]
 */
function wp_kama_rest_route_data_filter( $available, $routes ){

	// filter...
	return $available;
}
$available(array[])
Route data to expose in indexes, keyed by route.
$routes(массив)
Internal route data as an associative array.

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

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

Где вызывается хук

WP_REST_Server::get_data_for_routes()
rest_route_data
wp-includes/rest-api/class-wp-rest-server.php 1534
return apply_filters( 'rest_route_data', $available, $routes );

Где используется хук в WordPress

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