From 098ab594feaf3be96213a97d3ea153fd2d2a6753 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 22 Jun 2021 05:55:52 +0000 Subject: [PATCH] Themes: Improve Gutenberg check before activating an FSE theme. Account for sites enabling Gutenberg as an mu-plugin when determining whether full-site-editing themes can be enabled. This replaces the check the plugin is active with a check whether the function `gutenberg_is_fse_theme()` is defined. Follow up to [51193]. Props noisysocks, peterwilsoncc, SergeyBiryukov. See #53410. git-svn-id: https://develop.svn.wordpress.org/trunk@51197 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/customize.php | 2 +- src/wp-includes/theme.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php index fdbc7f7b9e..699ecdf914 100644 --- a/src/wp-admin/customize.php +++ b/src/wp-admin/customize.php @@ -189,7 +189,7 @@ do_action( 'customize_controls_head' ); // Check if the theme requires the FSE to work correctly. $theme_tags = $wp_customize->theme()->get( 'Tags' ); - if ( ! empty( $theme_tags ) && in_array( 'full-site-editing', $theme_tags, true ) && ! is_plugin_active( 'gutenberg/gutenberg.php' ) ) { + if ( ! empty( $theme_tags ) && in_array( 'full-site-editing', $theme_tags, true ) && ! function_exists( 'gutenberg_is_fse_theme' ) ) { $fse_safe = false; } ?> diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index cbf1849d21..a1a4af1946 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -911,7 +911,7 @@ function validate_theme_requirements( $stylesheet ) { // If the theme is a Full Site Editing theme, check for the presence of the Gutenberg plugin. $theme_tags = $theme->get( 'Tags' ); - if ( ! empty( $theme_tags ) && in_array( 'full-site-editing', $theme_tags, true ) && ! is_plugin_active( 'gutenberg/gutenberg.php' ) ) { + if ( ! empty( $theme_tags ) && in_array( 'full-site-editing', $theme_tags, true ) && ! function_exists( 'gutenberg_is_fse_theme' ) ) { return new WP_Error( 'theme_requires_fse', sprintf(