diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 7c25d07b2c..ee74099766 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1576,11 +1576,6 @@ final class WP_Theme implements ArrayAccess { * @return bool */ public function is_block_theme() { - if ( ! did_action( 'setup_theme' ) ) { - _doing_it_wrong( __METHOD__, __( 'This method should not be called before themes are set up.' ), '6.8.0' ); - return false; - } - if ( isset( $this->block_theme ) ) { return $this->block_theme; } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 0a3f7c5d65..b4a71d855a 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -4352,6 +4352,11 @@ function create_initial_theme_features() { * @return bool Whether the active theme is a block-based theme or not. */ function wp_is_block_theme() { + if ( empty( $GLOBALS['wp_theme_directories'] ) ) { + _doing_it_wrong( __FUNCTION__, __( 'This function should not be called before the theme directory is registered.' ), '6.8.0' ); + return false; + } + return wp_get_theme()->is_block_theme(); } diff --git a/wp-includes/version.php b/wp-includes/version.php index eb7ce2af40..2ba6f642a5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-beta2-60036'; +$wp_version = '6.8-beta2-60037'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.