Skip to content

Commit

Permalink
Refactor the gutenberg_is_fse_theme function to use `wp_is_block_th…
Browse files Browse the repository at this point in the history
…eme` (#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.
  • Loading branch information
anton-vlasenko authored and youknowriad committed Dec 8, 2021
1 parent 5c446d7 commit ca1e4cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/full-site-editing/full-site-editing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}
Expand Down

0 comments on commit ca1e4cb

Please sign in to comment.