rest_namespace_index
Filters the REST API namespace index data.
This typically is just the route data for the namespace, but you can add any data you'd like here.
Использование
add_filter( 'rest_namespace_index', 'wp_kama_rest_namespace_index_filter', 10, 2 ); /** * Function for `rest_namespace_index` filter-hook. * * @param WP_REST_Response $response Response data. * @param WP_REST_Request $request Request data. The namespace is passed as the 'namespace' parameter. * * @return WP_REST_Response */ function wp_kama_rest_namespace_index_filter( $response, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- Response data.
- $request(WP_REST_Request)
- Request data. The namespace is passed as the 'namespace' parameter.
Список изменений
С версии 4.4.0 | Введена. |
Где вызывается хук
rest_namespace_index
wp-includes/rest-api/class-wp-rest-server.php 1421
return apply_filters( 'rest_namespace_index', $response, $request );