Checkt, ob Setting in theme.json auf false gesetzt wurde. Wenn ja, wird Variable nicht mehr ausgegeben.
PHP
add_filter( 'wp_theme_json_data_theme', function ( \WP_Theme_JSON_Data $theme_json ): \WP_Theme_JSON_Data {
$data = $theme_json->get_data();
$color = &$data['settings']['color'];
if ( $color['defaultDuotone'] === false ) {
$color['duotone']['default'] = array();
}
if ( $color['defaultGradients'] === false ) {
$color['gradients']['default'] = array();
}
if ( $color['defaultPalette'] === false ) {
$color['palette']['default'] = array();
}
$dimensions = &$data['settings']['dimensions'];
if ( $dimensions['defaultAspectRatios'] === false ) {
$dimensions['aspectRatios']['default'] = array();
}
$shadow = &$data['settings']['shadow'];
if ( $shadow['defaultPresets'] === false ) {
$shadow['presets']['default'] = array();
}
$spacing = &$data['settings']['spacing'];
if ( $spacing['defaultSpacingSizes'] === false ) {
$spacing['spacingSizes']['default'] = array();
}
$typography = &$data['settings']['typography'];
if ( $typography['defaultFontSizes'] === false ) {
$typography['fontSizes']['default'] = array();
}
$theme_json->update_with( $data );
return $theme_json;
} );