General: Only use _jsonp_wp_die_handler() for JSONP REST API requests.

Props mdawaffe, peterwilsoncc.
Merges [51740] to the 5.3 branch.

git-svn-id: https://develop.svn.wordpress.org/branches/5.3@51746 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-09-08 17:23:36 +00:00
parent d7001071dd
commit 8c4da3c477

View File

@ -3250,9 +3250,9 @@ function wp_die( $message = '', $title = '', $args = array() ) {
* @param callable $function Callback function name. * @param callable $function Callback function name.
*/ */
$function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); $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 * @since 5.2.0
* *