diff --git a/wp-includes/block-patterns.php b/wp-includes/block-patterns.php index 7f20d9a894..b74f75611f 100644 --- a/wp-includes/block-patterns.php +++ b/wp-includes/block-patterns.php @@ -328,6 +328,17 @@ function _register_remote_theme_patterns() { * @access private */ function _register_theme_block_patterns() { + + /* + * During the bootstrap process, a check for active and valid themes is run. + * If no themes are returned, the theme's functions.php file will not be loaded, + * which can lead to errors if patterns expect some variables or constants to + * already be set at this point, so bail early if that is the case. + */ + if ( empty( wp_get_active_and_valid_themes() ) ) { + return; + } + /* * Register patterns for the active theme. If the theme is a child theme, * let it override any patterns from the parent theme that shares the same slug. diff --git a/wp-includes/version.php b/wp-includes/version.php index a95a7a5826..967ad172e2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57019'; +$wp_version = '6.5-alpha-57021'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.