wp_rest_server_class
Filters the REST Server Class.
This filter allows you to adjust the server class used by the REST API, using a different class to handle requests.
Usage
add_filter( 'wp_rest_server_class', 'wp_kama_rest_server_class_filter' ); /** * Function for `wp_rest_server_class` filter-hook. * * @param string $class_name The name of the server class. * * @return string */ function wp_kama_rest_server_class_filter( $class_name ){ // filter... return $class_name; }
- $class_name(string)
- The name of the server class.
Default: 'WP_REST_Server'
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
wp_rest_server_class
wp-includes/rest-api.php 576
$wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' );