From 5702452f4be96ee5736cec3ecc565670bf4a62f5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 8 Sep 2021 17:28:31 +0000 Subject: [PATCH] General: Only use `_jsonp_wp_die_handler()` for JSONP REST API requests. Props mdawaffe, peterwilsoncc. Merges [51740] to the 5.2 branch. Built from https://develop.svn.wordpress.org/branches/5.2@51747 git-svn-id: http://core.svn.wordpress.org/branches/5.2@51355 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1647b513fa..9d9e84be17 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3009,9 +3009,9 @@ function wp_die( $message = '', $title = '', $args = array() ) { * @param callable $function Callback function name. */ $function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); - } elseif ( wp_is_jsonp_request() ) { + } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) { /** - * Filters the callback for killing WordPress execution for JSONP requests. + * Filters the callback for killing WordPress execution for JSONP REST requests. * * @since 5.2.0 *