Make WordPress Core


Ignore:
Timestamp:
08/19/2025 06:50:05 PM (3 months ago)
Author:
jonsurrell
Message:

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 https://github.com/WordPress/wordpress-develop/pull/8145.

Props jonsurrell, bernhard-reiter, dmsnell, artpi, ankitkumarshah, abcd95, dilipbheda, sainathpoojary, shanemuir.
Fixes #62797.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-editor.php

    r60003 r60648  
    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'
Note: See TracChangeset for help on using the changeset viewer.