From 67044fe410ffcbf9a39bbc7a612014acb4e58ec1 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 31 Oct 2016 00:18:14 +0000 Subject: [PATCH] REST API: Add `PATCH` to CORS allowed methods. Editable resources in the REST API accept the `PATCH` method, but the CORS headers don't mention it. Props jnylen0. Fixes #38546. git-svn-id: https://develop.svn.wordpress.org/trunk@39042 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/rest-api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index 7a44856aaf..91b7343f56 100644 --- a/src/wp-includes/rest-api.php +++ b/src/wp-includes/rest-api.php @@ -514,7 +514,7 @@ function rest_send_cors_headers( $value ) { if ( $origin ) { header( 'Access-Control-Allow-Origin: ' . esc_url_raw( $origin ) ); - header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' ); + header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin' ); }