From 86e4d431d7b31bd9381cd73fcbdfd6ea0b783293 Mon Sep 17 00:00:00 2001 From: "Stephen A. Bernhardt" Date: Tue, 26 Aug 2025 09:07:44 -0500 Subject: [PATCH 1/2] Add `theme.json` support for `pre` --- src/wp-includes/class-wp-theme-json.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 588aeaa89e38e..14c4e06c38494 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -600,7 +600,8 @@ class WP_Theme_JSON { * The valid elements that can be found under styles. * * @since 5.8.0 - * @since 6.1.0 Added `heading`, `button`, and `caption` elements. + * @since 6.1.0 Added `heading`, `button`, `caption`, and `cite` elements. + * @since 6.9.0 Added `pre` element. * @var string[] */ const ELEMENTS = array( @@ -617,6 +618,7 @@ class WP_Theme_JSON { // The block classes are necessary to target older content that won't use the new class names. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', 'cite' => 'cite', + 'pre' => 'pre', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From 11ed05d408cf39c7c4e588b291c5f105add877f5 Mon Sep 17 00:00:00 2001 From: "Stephen A. Bernhardt" Date: Tue, 26 Aug 2025 09:08:24 -0500 Subject: [PATCH 2/2] Add CSS for `pre` in each `theme.json` --- src/wp-content/themes/twentytwentyfive/theme.json | 3 +++ src/wp-content/themes/twentytwentyfour/theme.json | 3 +++ src/wp-content/themes/twentytwentythree/theme.json | 3 +++ src/wp-content/themes/twentytwentytwo/theme.json | 3 +++ 4 files changed, 12 insertions(+) diff --git a/src/wp-content/themes/twentytwentyfive/theme.json b/src/wp-content/themes/twentytwentyfive/theme.json index 7daeb0dbd749d..27837f9fcb04e 100644 --- a/src/wp-content/themes/twentytwentyfive/theme.json +++ b/src/wp-content/themes/twentytwentyfive/theme.json @@ -682,6 +682,9 @@ "textDecoration": "none" } } + }, + "pre": { + "css": "&{overflow-x:auto;}" } } }, diff --git a/src/wp-content/themes/twentytwentyfour/theme.json b/src/wp-content/themes/twentytwentyfour/theme.json index 134da2894ea44..55553daba5808 100644 --- a/src/wp-content/themes/twentytwentyfour/theme.json +++ b/src/wp-content/themes/twentytwentyfour/theme.json @@ -891,6 +891,9 @@ "color": { "text": "var(--wp--preset--color--contrast)" } + }, + "pre": { + "css": "&{overflow-x:auto;}" } }, "spacing": { diff --git a/src/wp-content/themes/twentytwentythree/theme.json b/src/wp-content/themes/twentytwentythree/theme.json index 4ac5ac8920c61..d4c548393a9a3 100644 --- a/src/wp-content/themes/twentytwentythree/theme.json +++ b/src/wp-content/themes/twentytwentythree/theme.json @@ -699,6 +699,9 @@ "typography": { "textDecoration": "underline" } + }, + "pre": { + "css": "&{overflow-x:auto;}" } }, "spacing": { diff --git a/src/wp-content/themes/twentytwentytwo/theme.json b/src/wp-content/themes/twentytwentytwo/theme.json index da4e623a002c8..52a5a1398c352 100644 --- a/src/wp-content/themes/twentytwentytwo/theme.json +++ b/src/wp-content/themes/twentytwentytwo/theme.json @@ -338,6 +338,9 @@ "color": { "text": "var(--wp--preset--color--foreground)" } + }, + "pre": { + "css": "&{overflow-x:auto;}" } }, "spacing": {