rest_endpoints
Filters the array of available REST API endpoints.
Usage
add_filter( 'rest_endpoints', 'wp_kama_rest_endpoints_filter' );
/**
* Function for `rest_endpoints` filter-hook.
*
* @param array $endpoints The available endpoints. An array of matching regex patterns, each mapped to an array of callbacks for the endpoint. These take the format `'/path/regex' => array( $callback, $bitmask )` or `'/path/regex' => array( array( $callback, $bitmask ).
*
* @return array
*/
function wp_kama_rest_endpoints_filter( $endpoints ){
// filter...
return $endpoints;
}
- $endpoints(array)
- The available endpoints. An array of matching regex patterns, each mapped to an array of callbacks for the endpoint. These take the format
'/path/regex' => array( $callback, $bitmask )or `'/path/regex' => array( array( $callback, $bitmask ).
Changelog
| Since 4.4.0 | Introduced. |
Where the hook is called
rest_endpoints
wp-includes/rest-api/class-wp-rest-server.php 968
$endpoints = apply_filters( 'rest_endpoints', $endpoints );