From 48432294aa2dec3ec2ca9daa92dcc28f81fdbb4b Mon Sep 17 00:00:00 2001 From: Anton Vlasenko Date: Mon, 6 Dec 2021 17:12:41 +0100 Subject: [PATCH 1/2] Rename wp_is_block_template_theme to wp_is_block_theme --- lib/compat/wordpress-5.9/template-parts.php | 4 ++-- lib/compat/wordpress-5.9/templates.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compat/wordpress-5.9/template-parts.php b/lib/compat/wordpress-5.9/template-parts.php index 1d84d00afbe48..a095bbe6643e0 100644 --- a/lib/compat/wordpress-5.9/template-parts.php +++ b/lib/compat/wordpress-5.9/template-parts.php @@ -12,8 +12,8 @@ */ // Only run any of the code in this file if the version is less than 5.9. -// wp_is_block_template_theme was introduced in 5.9. -if ( ! function_exists( 'wp_is_block_template_theme' ) ) { +// wp_is_block_theme was introduced in 5.9. +if ( ! function_exists( 'wp_is_block_theme' ) ) { /** * Registers block editor 'wp_template_part' post type. */ diff --git a/lib/compat/wordpress-5.9/templates.php b/lib/compat/wordpress-5.9/templates.php index 93b8c40a8c0cf..c6f41eff9c9d6 100644 --- a/lib/compat/wordpress-5.9/templates.php +++ b/lib/compat/wordpress-5.9/templates.php @@ -12,8 +12,8 @@ */ // Only run any of the code in this file if the version is less than 5.9. -// wp_is_block_template_theme was introduced in 5.9. -if ( ! function_exists( 'wp_is_block_template_theme' ) ) { +// wp_is_block_theme was introduced in 5.9. +if ( ! function_exists( 'wp_is_block_theme' ) ) { /** * Registers block editor 'wp_template' post type. */ From 4f895e79a0475ef5d0585ba33bc58691b7849ecb Mon Sep 17 00:00:00 2001 From: Anton Vlasenko Date: Mon, 6 Dec 2021 17:55:17 +0100 Subject: [PATCH 2/2] Use wp_is_block_theme (if it's available). Add a note about future deprecation of the gutenberg_is_fse_theme function. --- lib/full-site-editing/full-site-editing.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/full-site-editing/full-site-editing.php b/lib/full-site-editing/full-site-editing.php index 8320d1b32ccb3..9e04a8388d267 100644 --- a/lib/full-site-editing/full-site-editing.php +++ b/lib/full-site-editing/full-site-editing.php @@ -8,9 +8,17 @@ /** * Returns whether the current theme is an FSE theme or not. * + * Note: once 5.9 is the minimum supported WordPress version for the Gutenberg + * plugin, we must deprecate this function and + * use wp_is_block_theme instead. + * * @return boolean Whether the current theme is an FSE theme or not. */ function gutenberg_is_fse_theme() { + if ( function_exists( 'wp_is_block_theme' ) ) { + return wp_is_block_theme(); + } + return is_readable( get_theme_file_path( '/block-templates/index.html' ) ) || is_readable( get_theme_file_path( '/templates/index.html' ) ); }