Skip to content

Commit

Permalink
Theme Previews: Fix refactor (#50354)
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian authored May 4, 2023
1 parent fd64307 commit 516201e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/compat/wordpress-6.3/theme-previews.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function gutenberg_get_theme_preview_path( $current_stylesheet = null ) {
$preview_stylesheet = ! empty( $_GET['theme_preview'] ) ? $_GET['theme_preview'] : null;
$wp_theme = wp_get_theme( $preview_stylesheet );
if ( ! is_wp_error( $wp_theme->errors() ) ) {
if ( current_filter() === 'stylesheet' ) {
$theme_path = $wp_theme->get_stylesheet();
} elseif ( current_filter() === 'template' ) {
if ( current_filter() === 'template' ) {
$theme_path = $wp_theme->get_template();
} else {
$theme_path = $wp_theme->get_stylesheet();
}

return sanitize_text_field( $theme_path );
Expand Down Expand Up @@ -104,7 +104,7 @@ function addLivePreviewButton() {
* Adds a nonce for the theme activation link.
*/
function block_theme_activate_nonce() {
$nonce_handle = 'switch-theme_' . gutenberg_theme_preview_stylesheet();
$nonce_handle = 'switch-theme_' . gutenberg_get_theme_preview_path();
?>
<script type="text/javascript">
window.BLOCK_THEME_ACTIVATE_NONCE = '<?php echo wp_create_nonce( $nonce_handle ); ?>';
Expand Down

0 comments on commit 516201e

Please sign in to comment.