From 81156249559d7dd2f5eedaeabedca0e5e48021c7 Mon Sep 17 00:00:00 2001 From: Kevin Zoschke Date: Fri, 7 Jun 2024 14:12:45 -0400 Subject: [PATCH] Admin menu: add link to Customizer in sites with block-based theme and custom CSS --- .../jetpack/changelog/fix-custom-css-block-based-themes | 4 ++++ projects/plugins/jetpack/class.jetpack-admin.php | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/jetpack/changelog/fix-custom-css-block-based-themes diff --git a/projects/plugins/jetpack/changelog/fix-custom-css-block-based-themes b/projects/plugins/jetpack/changelog/fix-custom-css-block-based-themes new file mode 100644 index 0000000000000..b96529bdf2220 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-custom-css-block-based-themes @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Admin menu: add link to Customizer in sites with block-based theme and custom CSS diff --git a/projects/plugins/jetpack/class.jetpack-admin.php b/projects/plugins/jetpack/class.jetpack-admin.php index fb453a4adcfd9..73e437c1d83f3 100644 --- a/projects/plugins/jetpack/class.jetpack-admin.php +++ b/projects/plugins/jetpack/class.jetpack-admin.php @@ -139,7 +139,12 @@ public static function additional_css_menu() { // See https://github.com/Automattic/jetpack/pull/19965 for more on how this menu item is dealt with on WoA sites. if ( ( new Host() )->is_woa_site() && ! ( in_array( 'custom-css', Jetpack::get_available_modules(), true ) ) ) { return; - } elseif ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-css' ) ) { // If the Custom CSS module is enabled, add the Additional CSS menu item and link to the Customizer. + } elseif ( + class_exists( 'Jetpack' ) && ( + Jetpack::is_module_active( 'custom-css' ) || // If the Custom CSS module is enabled, add the Additional CSS menu item and link to the Customizer. + ( wp_is_block_theme() && ! empty( wp_get_custom_css() ) ) // Do the same if the theme is block-based but has existing custom CSS. + ) + ) { // Add in our legacy page to support old bookmarks and such. add_submenu_page( '', __( 'CSS', 'jetpack' ), __( 'Additional CSS', 'jetpack' ), 'edit_theme_options', 'editcss', array( __CLASS__, 'customizer_redirect' ) );