rest_prepare_theme
Filters theme data returned from the REST API.
Usage
add_filter( 'rest_prepare_theme', 'wp_kama_rest_prepare_theme_filter', 10, 3 ); /** * Function for `rest_prepare_theme` filter-hook. * * @param WP_REST_Response $response The response object. * @param WP_Theme $theme Theme object used to create response. * @param WP_REST_Request $request Request object. * * @return WP_REST_Response */ function wp_kama_rest_prepare_theme_filter( $response, $theme, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- The response object.
- $theme(WP_Theme)
- Theme object used to create response.
- $request(WP_REST_Request)
- Request object.
Changelog
Since 5.0.0 | Introduced. |
Where the hook is called
rest_prepare_theme
wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php 369
return apply_filters( 'rest_prepare_theme', $response, $theme, $request );