rest_route_data WordPress Filter Hook

The rest_route_data hook allows you to modify the data that is used to generate the REST API response for a given route. This is useful for adding extra data to the response, or for changing the data that is returned.

apply_filters( 'rest_route_data', array[] $available, array $routes ) #

Filters the publicly-visible data for REST API routes.


Description

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.


Top ↑

Parameters

$available

(array[])Route data to expose in indexes, keyed by route.

$routes

(array)Internal route data as an associative array.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-server.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.