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
This commit is contained in:
Greg Ziółkowski
2022-05-17 12:08:15 +00:00
parent 7e1610cf37
commit 0be18df792
2 changed files with 2 additions and 2 deletions

View File

@@ -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();

View File

@@ -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 ) );