From e16a4b03a2a3d5f6ab444d7faa3318b37417abe3 Mon Sep 17 00:00:00 2001 From: Swashata Ghosh Date: Mon, 27 Nov 2023 21:26:25 +0530 Subject: [PATCH 1/2] [start-logic] [theme-preview] [fix] Apply the temporary patch only when WP version is between (inclusive) 6.3 and 6.3.1, after which the bug was fixed in the core (6.3.2+). --- start.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/start.php b/start.php index 76df0bd7..5be3d850 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.6.0'; + $this_sdk_version = '2.6.0.1'; #region SDK Selection Logic -------------------------------------------------------------------- @@ -47,15 +47,20 @@ $file_path = fs_normalize_path( __FILE__ ); $fs_root_path = dirname( $file_path ); + // @todo: Remove this code after a few months when WP 6.3 usage is low enough. + global $wp_version; + if ( ! function_exists( 'wp_get_current_user' ) && /** * `get_stylesheet()` will rely on `wp_get_current_user()` when it is being filtered by `theme-previews.php`. That happens only when the site editor is loaded or when the site editor is sending REST requests. * @see theme-previews.php:wp_get_theme_preview_path() * - * @todo If this behavior is fixed in the core, we will remove this workaround. + * @todo This behavior is already fixed in the core (WP 6.3.2+), and this code can be removed after a few months when WP 6.3 usage is low enough. * @since WP 6.3.0 */ + version_compare( $wp_version, '6.3', '>=' ) && + version_compare( $wp_version, '6.3.1', '<=' ) && ( 'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) || ( From e81b46a2cc8221f40c5e2036ec8d63ee253cf738 Mon Sep 17 00:00:00 2001 From: Swashata Ghosh Date: Sun, 3 Dec 2023 13:38:11 +0530 Subject: [PATCH 2/2] [version] [patch] Version 2.6.1 --- start.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.php b/start.php index 5be3d850..5a6811d6 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.6.0.1'; + $this_sdk_version = '2.6.1'; #region SDK Selection Logic --------------------------------------------------------------------