rest_exposed_cors_headers filter-hookWP 5.5.0

Filters the list of response headers that are exposed to REST API CORS requests.


add_filter( 'rest_exposed_cors_headers', 'wp_kama_rest_exposed_cors_headers_filter', 10, 2 );

 * Function for `rest_exposed_cors_headers` filter-hook.
 * @param string[]        $expose_headers The list of response headers to expose.
 * @param WP_REST_Request $request        The request in context.
 * @return string[]
function wp_kama_rest_exposed_cors_headers_filter( $expose_headers, $request ){

	// filter...
	return $expose_headers;
The list of response headers to expose.
The request in context.


Since 5.5.0 Introduced.
Since 6.3.0 The $request parameter was added.

Where the hook is called

wp-includes/rest-api/class-wp-rest-server.php 414
$expose_headers = apply_filters( 'rest_exposed_cors_headers', $expose_headers, $request );

Where the hook is used in WordPress

Usage not found.