rest_allowed_cors_headers WordPress Filter Hook

The rest_allowed_cors_headers hook allows you to add additional headers to the list of headers allowed by the CORS policy for the REST API.

apply_filters( 'rest_allowed_cors_headers', string[] $allow_headers ) #

Filters the list of request headers that are allowed for REST API CORS requests.


Description

The allowed headers are passed to the browser to specify which headers can be passed to the REST API. By default, we allow the Content-* headers needed to upload files to the media endpoints. As well as the Authorization and Nonce headers for allowing authentication.


Top ↑

Parameters

$allow_headers

(string[])The list of request headers to allow.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-server.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.