From 9e5a64dacff9b6a96738cf4d7710e95f4dab59e4 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 10 Oct 2022 15:49:28 +0800 Subject: [PATCH] Add inline script for the old persistence system --- src/wp-includes/script-loader.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index f3014a241f336..5d842f5787a11 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -383,6 +383,22 @@ function wp_default_packages_inline_scripts( $scripts ) { ) ); + // Backwards compatibility - configure the old wp-data persistence system. + $scripts->add_inline_script( + 'wp-data', + implode( + "\n", + array( + '( function() {', + ' var userId = ' . get_current_user_ID() . ';', + ' var storageKey = "WP_DATA_USER_" + userId;', + ' wp.data', + ' .use( wp.data.plugins.persistence, { storageKey: storageKey } );', + '} )();', + ) + ) + ); + // Calculate the timezone abbr (EDT, PST) if possible. $timezone_string = get_option( 'timezone_string', 'UTC' ); $timezone_abbr = '';