From dcc249ed3c51b1068c9eadbebadfe6b0e98c2497 Mon Sep 17 00:00:00 2001 From: Aadil Ayub Date: Thu, 10 Apr 2025 10:06:12 +0500 Subject: [PATCH] remove core wp theme.json variables --- functions.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/functions.php b/functions.php index e589ee8..e4dbb6a 100644 --- a/functions.php +++ b/functions.php @@ -42,6 +42,37 @@ function cc_mime_types($mimes) } add_filter('upload_mimes', 'cc_mime_types'); +/* Remove default CSS variables that come with Wordpress + https://github.com/WordPress/gutenberg/issues/56180#issuecomment-1819222376 +*/ +function custom_wp_theme_json_default( $theme_json ) { + $new_data = array( + 'version' => 2, + 'settings' => array( + 'color' => array( + 'palette' => array(), + 'gradients' => array(), + ), + 'shadow' => array( + 'presets' => array(), + ), + 'typography' => array( + 'fontSizes' => array(), + ), + // 'dimensions' => array( + // 'aspectRatios' => array(), + // ), + // 'spacing' => array( + // 'spacingScale' => array( + // 'steps' => 0, + // ), + // ), + ), + ); + return $theme_json->update_with( $new_data ); +} +add_filter( 'wp_theme_json_data_default', 'custom_wp_theme_json_default' ); + // remove default woocommerce fonts add_filter('wp_theme_json_data_theme', 'disable_inter_font', 100); function disable_inter_font($theme_json)