Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Interactivity API store JSON encoding #6520

Closed
wants to merge 12 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ public function print_client_interactivity_data() {
}

if ( ! empty( $interactivity_data ) ) {
$json_encode_flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_SLASHES;
if ( str_starts_with( get_option( 'blog_charset' ), 'UTF-' ) ) {
sirreal marked this conversation as resolved.
Show resolved Hide resolved
$json_encode_flags |= JSON_UNESCAPED_UNICODE;
}

wp_print_inline_script_tag(
wp_json_encode(
$interactivity_data,
JSON_HEX_TAG | JSON_HEX_AMP
$json_encode_flags
),
array(
'type' => 'application/json',
Expand Down
Loading