diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php index 311deaf256590..c81ab65b9e593 100644 --- a/src/wp-includes/block-editor.php +++ b/src/wp-includes/block-editor.php @@ -769,10 +769,8 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont add_filter( 'scriptmoduledata_@wordpress/api-fetch', function ( $data ) use ( $preload_data ) { - return array_merge( - $data, - array( 'preloadData' => $preload_data ) - ); + $data['preloadData'] = $preload_data; + return $data; } ); } diff --git a/src/wp-includes/script-modules.php b/src/wp-includes/script-modules.php index 80ef13f0a2d8d..3a3076f6c88bb 100644 --- a/src/wp-includes/script-modules.php +++ b/src/wp-includes/script-modules.php @@ -129,15 +129,11 @@ function wp_register_default_script_modules(): void { add_filter( 'scriptmoduledata_@wordpress/api-fetch', function ( $data ) { - return array_merge( - $data, - array( - 'rootURL' => sanitize_url( get_rest_url() ), - 'nonce' => wp_installing() ? '' : wp_create_nonce( 'wp_rest' ), - 'shouldRegisterMediaUploadMiddleware' => true, - 'nonceEndpoint' => admin_url( 'admin-ajax.php?action=rest-nonce' ), - ) - ); + $data['rootURL'] = sanitize_url( get_rest_url() ); + $data['nonce'] = wp_installing() ? '' : wp_create_nonce( 'wp_rest' ); + $data['shouldRegisterMediaUploadMiddleware'] = true; + $data['nonceEndpoint'] = admin_url( 'admin-ajax.php?action=rest-nonce' ); + return $data; } ); } diff --git a/src/wp-includes/theme-previews.php b/src/wp-includes/theme-previews.php index 88e992a8cd4aa..b4495af8429c8 100644 --- a/src/wp-includes/theme-previews.php +++ b/src/wp-includes/theme-previews.php @@ -57,12 +57,8 @@ function wp_attach_theme_preview_middleware() { add_filter( 'scriptmoduledata_@wordpress/api-fetch', function ( $data ) { - return array_merge( - $data, - array( - 'themePreviewPath' => sanitize_text_field( wp_unslash( $_GET['wp_theme_preview'] ) ), - ) - ); + $data['themePreviewPath'] = sanitize_text_field( wp_unslash( $_GET['wp_theme_preview'] ) ); + return $data; } ); }