Skip to content

Commit a87cdb1

Browse files
committed
Editor: Ensure preloading middleware JSON is correctly encoded.
Adds the appropriate JSON flags to `wp_json_encode()` to safely encode data for use in script tags. Developed in WordPress/wordpress-develop#8145. Props jonsurrell, bernhard-reiter, dmsnell, artpi, ankitkumarshah, abcd95, dilipbheda, sainathpoojary, shanemuir. Fixes #62797. Built from https://develop.svn.wordpress.org/trunk@60648 git-svn-id: https://core.svn.wordpress.org/trunk@59984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 7b6f66e commit a87cdb1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

wp-includes/block-editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
766766
'wp-api-fetch',
767767
sprintf(
768768
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
769-
wp_json_encode( $preload_data )
769+
wp_json_encode( $preload_data, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
770770
),
771771
'after'
772772
);

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '6.9-alpha-60647';
19+
$wp_version = '6.9-alpha-60648';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)