Export fails if field missing in them.json
-
Hey!
Today I tried to export a custom child theme including the fonts from the site editor and run into the following warnings and errors:
[12-May-2024 14:21:46 UTC] PHP Warning: Undefined array key "typography" in /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php on line 111 [12-May-2024 14:21:46 UTC] PHP Warning: Trying to access array offset on null in /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php on line 111 [12-May-2024 14:21:46 UTC] PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php:110 Stack trace: #0 /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php(110): array_filter(NULL, Object(Closure)) #1 /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php(11): Theme_Fonts::remove_deactivated_fonts_from_theme() #2 /wp-content/plugins/create-block-theme/includes/class-create-block-theme-api.php(444): Theme_Fonts::persist_font_settings() #3 /wp-includes/rest-api/class-wp-rest-server.php(1230): Create_Block_Theme_API->rest_save_theme(Object(WP_REST_Request)) #4 /wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/create-block-t...', Array, NULL) #5 /wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request)) #6 /wp-includes/rest-api.php(428): WP_REST_Server->serve_request('/create-block-t...') #7 /wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP)) #8 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #9 /wp-includes/plugin.php(565): WP_Hook->do_action(Array) #10 /wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array) #11 /wp-includes/class-wp.php(813): WP->parse_request('') #12 /wp-includes/functions.php(1336): WP->main('') #13 /wp-blog-header.php(16): wp() #14 /index.php(17): require('/Users/mrx') #15 {main} thrown in /wp-content/plugins/create-block-theme/admin/create-theme/theme-fonts.php on line 110
The custom theme.json doesn’t have a typography field inside the settings array.
As soon as I add the following array to the theme.json file the export works fine:
"typography": { "fontFamilies": [] }
Greetings
derRALF
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.