rest_allowed_cors_headers

FILTER wp-includes\rest-api\class-wp-rest-server.php (ligne 432) github
Filters the list of request headers that are allowed for REST API CORS requests. 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.

Paramètres

Entrée :
$allow_headers, $request
Sortie :
@param string[]        $allow_headers The list of request headers to allow.
@param WP_REST_Request $request       The request in context.

Utilisation

// Modifier la valeur avec le filtre 'rest_allowed_cors_headers'
add_filter('rest_allowed_cors_headers', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($allow_headers) {
    // Modifier la valeur
    return $allow_headers;
}

Actualités

Chargement des actualités...