Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Always use JSON_HEX_TAG | JSON_UNESCAPED_SLASHES flags"
This reverts commit d630c7d5610ab5ba91e0c304776add3d8daf40ec.
  • Loading branch information
sirreal committed Aug 19, 2025
commit 554080bd11faf9c2a1efb677f91c880f6fe987fb
7 changes: 6 additions & 1 deletion src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,16 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
$wp_scripts = $backup_wp_scripts;
$wp_styles = $backup_wp_styles;

$json_encode_flags = JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS;
if ( ! is_utf8_charset() ) {
$json_encode_flags = JSON_HEX_TAG | JSON_UNESCAPED_SLASHES;
}

wp_add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
wp_json_encode( $preload_data, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
wp_json_encode( $preload_data, $json_encode_flags )
),
'after'
);
Expand Down