rest_route_data
Filter HookDescription
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.Hook Information
File Location |
wp-includes/rest-api/class-wp-rest-server.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1599 |
Hook Parameters
Type | Name | Description |
---|---|---|
array[]
|
$available
|
Route data to expose in indexes, keyed by route. |
array
|
$routes
|
Internal route data as an associative array. |
Usage Examples
Basic Usage
<?php
// Hook into rest_route_data
add_filter('rest_route_data', 'my_custom_filter', 10, 2);
function my_custom_filter($available, $routes) {
// Your custom filtering logic here
return $available;
}
Source Code Context
wp-includes/rest-api/class-wp-rest-server.php:1599
- How this hook is used in WordPress core
<?php
1594 * @since 4.4.0
1595 *
1596 * @param array[] $available Route data to expose in indexes, keyed by route.
1597 * @param array $routes Internal route data as an associative array.
1598 */
1599 return apply_filters( 'rest_route_data', $available, $routes );
1600 }
1601
1602 /**
1603 * Retrieves publicly-visible data for the route.
1604 *
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/rest-api/class-wp-rest-server.php
Related Hooks
Related hooks will be displayed here in future updates.