From 89468bfb89b280f40c747475d080426787b1da23 Mon Sep 17 00:00:00 2001 From: whyisjake Date: Mon, 14 Oct 2019 16:25:04 +0000 Subject: [PATCH] REST API: Ensure that we don't generate warnings from sending extra headers after headers have been sent. Fixes issues stemming from [46478]. Built from https://develop.svn.wordpress.org/trunk@46483 git-svn-id: http://core.svn.wordpress.org/trunk@46281 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index b998cf7cda..653abc0c8d 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -589,7 +589,7 @@ function rest_send_cors_headers( $value ) { header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin' ); - } else if ( 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { + } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { header( 'Vary: Origin' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 838d9192f9..4ae9e73531 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-beta3-46478'; +$wp_version = '5.3-beta3-46483'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.