From ca1e4cb572434d76a75d9743fff5848c22419262 Mon Sep 17 00:00:00 2001 From: Anton Vlasenko <43744263+anton-vlasenko@users.noreply.github.com> Date: Tue, 7 Dec 2021 01:27:31 +0100 Subject: [PATCH] Refactor the `gutenberg_is_fse_theme` function to use `wp_is_block_theme` (#37161) * Rename wp_is_block_template_theme to wp_is_block_theme * 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 8320d1b32ccb3b..9e04a8388d2671 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' ) ); }