From 0be18df792a04989b9f7e88ff78df6dd2090e6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Tue, 17 May 2022 12:08:15 +0000 Subject: [PATCH] Theme: Use a better method to determine the theme name during export See the same change in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/40829. Props scruffian, davidbaumwald, jeremyfelt. See #55567. git-svn-id: https://develop.svn.wordpress.org/trunk@53402 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/block-template-utils.php | 2 +- .../endpoints/class-wp-rest-edit-site-export-controller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php index 0cfdccdc6e..381a70e85d 100644 --- a/src/wp-includes/block-template-utils.php +++ b/src/wp-includes/block-template-utils.php @@ -937,7 +937,7 @@ function wp_generate_block_templates_export_file() { } $obscura = wp_generate_password( 12, false, false ); - $theme_name = wp_get_theme()->get( 'TextDomain' ); + $theme_name = basename( get_stylesheet() ); $filename = get_temp_dir() . $theme_name . $obscura . '.zip'; $zip = new ZipArchive(); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php index dc81eeeccc..691760812b 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php @@ -82,7 +82,7 @@ class WP_REST_Edit_Site_Export_Controller extends WP_REST_Controller { return $filename; } - $theme_name = wp_get_theme()->get( 'TextDomain' ); + $theme_name = basename( get_stylesheet() ); header( 'Content-Type: application/zip' ); header( 'Content-Disposition: attachment; filename=' . $theme_name . '.zip' ); header( 'Content-Length: ' . filesize( $filename ) );