From c70c7ad811b799618a0c3f7812ccd7a461f237b5 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 29 Apr 2022 03:48:48 +0000 Subject: [PATCH] Install: Prevent DB errors caused by web fonts API. Bypass checking `theme.json` for web fonts during the installation of WordPress. During installation the active theme is considered to be Twenty Twenty-Two (the default theme). As a block theme this prompts a database call when the web fonts API checks the `theme.json` settings, this triggers a database error during installation as the database tables do not exist. Props chouby, costdev, peterwilsoncc, sergeybiryukov. Fixes #55632. git-svn-id: https://develop.svn.wordpress.org/trunk@53306 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index abe176cd83..6bdbc5c2f4 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -3057,6 +3057,11 @@ function wp_enqueue_block_style( $block_name, $args ) { * @access private */ function _wp_theme_json_webfonts_handler() { + // Block themes are unavailable during installation. + if ( wp_installing() ) { + return; + } + // Webfonts to be processed. $registered_webfonts = array();