Skip to content

Commit

Permalink
[start-logic] [theme-preview] [fix] Apply the temporary patch only wh…
Browse files Browse the repository at this point in the history
…en WP version is between (inclusive) 6.3 and 6.3.1, after which the bug was fixed in the core (6.3.2+).
  • Loading branch information
swashata committed Nov 29, 2023
1 parent 952ad24 commit a584635
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.6.0';
$this_sdk_version = '2.6.0.1';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down Expand Up @@ -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.312', '<=' ) &&
(
'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ||
(
Expand Down

0 comments on commit a584635

Please sign in to comment.