WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WP_REST_Server::get_data_for_routes() public WP 4.4.0

Retrieves the publicly-visible data for routes.

{} Это метод класса: WP_REST_Server{}

Хуки из метода

Массив[]. Route data to expose in indexes, keyed by route.


$WP_REST_Server = new WP_REST_Server();
$WP_REST_Server->get_data_for_routes( $routes, $context );
$routes(массив) (обязательный)
Routes to get data for.
Context for data. Accepts 'view' or 'help'.
По умолчанию: 'view'

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

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

Код WP_REST_Server::get_data_for_routes() WP 5.7.1

public function get_data_for_routes( $routes, $context = 'view' ) {
	$available = array();

	// Find the available routes.
	foreach ( $routes as $route => $callbacks ) {
		$data = $this->get_data_for_route( $route, $callbacks, $context );
		if ( empty( $data ) ) {

		 * Filters the REST API endpoint data.
		 * @since 4.4.0
		 * @param WP_REST_Request $request Request data. The namespace is passed as the 'namespace' parameter.
		$available[ $route ] = apply_filters( 'rest_endpoints_description', $data );

	 * 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.
	 * @since 4.4.0
	 * @param array[] $available Route data to expose in indexes, keyed by route.
	 * @param array   $routes    Internal route data as an associative array.
	return apply_filters( 'rest_route_data', $available, $routes );