From 8d0985abad88e7e959bd97a129ad807524dee3b3 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 11 Dec 2024 10:16:20 +0100 Subject: [PATCH] Improve example --- src/wp-includes/class-wp-script-modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-script-modules.php b/src/wp-includes/class-wp-script-modules.php index d48668d271a68..dbfa038f8cbe2 100644 --- a/src/wp-includes/class-wp-script-modules.php +++ b/src/wp-includes/class-wp-script-modules.php @@ -412,7 +412,7 @@ public function print_script_module_data(): void { * add_filter( * 'script_module_data_MyScriptModuleID', * function ( array $data ): array { - * $data['script-needs-this-data'] = 'ok'; + * $data['dataForClient'] = 'ok'; * return $data; * } * ); @@ -433,6 +433,7 @@ public function print_script_module_data(): void { * data = JSON.parse( dataContainer.textContent ); * } catch {} * } + * // data.dataForClient === 'ok'; * initMyScriptModuleWithData( data ); * * @since 6.7.0