diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php
index 37ad372db9..9ed08fc945 100644
a
|
b
|
class WP_Scripts extends WP_Dependencies { |
486 | 486 | $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
487 | 487 | } |
488 | 488 | |
489 | | $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; |
| 489 | if ( is_scalar( $l10n ) ) { |
| 490 | $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; |
| 491 | } else { |
| 492 | $script = "var $object_name = JSON.parse('" . wp_json_encode( $l10n ) . '\');'; |
| 493 | } |
490 | 494 | |
491 | 495 | if ( ! empty( $after ) ) { |
492 | 496 | $script .= "\n$after;"; |
diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php
index 8f323501a0..b2ba07aef8 100644
a
|
b
|
$script = sprintf( |
394 | 394 | $init_script, |
395 | 395 | $post->post_type, |
396 | 396 | $post->ID, |
397 | | wp_json_encode( $editor_settings ), |
| 397 | 'JSON.parse(\'' . wp_json_encode( $editor_settings ) . '\');', |
398 | 398 | wp_json_encode( $initial_edits ) |
399 | 399 | ); |
400 | 400 | wp_add_inline_script( 'wp-edit-post', $script ); |