diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php index a7c43b041f..baf0246a0f 100644 --- a/src/wp-includes/rest-api/class-wp-rest-server.php +++ b/src/wp-includes/rest-api/class-wp-rest-server.php @@ -243,7 +243,18 @@ class WP_REST_Server { * https://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/ */ $this->send_header( 'X-Content-Type-Options', 'nosniff' ); - $this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' ); + $expose_headers = array( 'X-WP-Total', 'X-WP-TotalPages', 'Link' ); + + /** + * Filters the list of response headers that are exposed to CORS requests. + * + * @since 5.5.0 + * + * @param string[] $expose_headers The list of headers to expose. + */ + $expose_headers = apply_filters( 'rest_exposed_cors_headers', $expose_headers ); + + $this->send_header( 'Access-Control-Expose-Headers', implode( ', ', $expose_headers ) ); $this->send_header( 'Access-Control-Allow-Headers', 'Authorization, Content-Type' ); /**