Skip to content

Commit

Permalink
Merge pull request #670 from Freemius/develop
Browse files Browse the repository at this point in the history
Fix block theme preview issue on WP 6.3.2 and above
  • Loading branch information
swashata authored Dec 3, 2023
2 parents 8a2bb8f + e81b46a commit 9fb47e3
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.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.3.1', '<=' ) &&
(
'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ||
(
Expand Down

0 comments on commit 9fb47e3

Please sign in to comment.