From 38cc04101fb03246d335e54060bd05c95ccad210 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 12 Feb 2026 21:43:26 +0100 Subject: [PATCH 1/9] Themes: Make current_theme_supports( 'html5', 'script' ) always return true. Since non-HTML5 script output was completely removed in r61415 (WordPress 7.0), all scripts are now output as HTML5. This change makes the theme support check reflect that reality by always returning true for script support, regardless of whether themes explicitly declare support. The behavior of add_theme_support() and remove_theme_support() remains unchanged. Only the check via current_theme_supports( 'html5', 'script' ) is affected. Props sirreal. Fixes #64442. --- src/wp-includes/theme.php | 6 ++++++ tests/phpunit/tests/theme/support.php | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 44343569a61b1..b870f9cae6c5c 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -3193,6 +3193,12 @@ function current_theme_supports( $feature, ...$args ) { * Specific areas of HTML5 support *must* be passed via an array to add_theme_support(). */ $type = $args[0]; + + // HTML5 script support is always enabled since non-HTML5 script output was removed in 7.0. + if ( 'html5' === $feature && 'script' === $type ) { + return true; + } + return in_array( $type, $_wp_theme_features[ $feature ][0], true ); case 'custom-logo': diff --git a/tests/phpunit/tests/theme/support.php b/tests/phpunit/tests/theme/support.php index aed9d94d3c1fd..e765a1fce1079 100644 --- a/tests/phpunit/tests/theme/support.php +++ b/tests/phpunit/tests/theme/support.php @@ -141,6 +141,28 @@ public function test_supports_html5_invalid() { $this->assertFalse( current_theme_supports( 'html5' ) ); } + /** + * Tests that `current_theme_supports( 'html5', 'script' )` always returns true. + * + * Non-HTML5 script output was removed in WordPress 7.0, so script support + * is now always enabled regardless of theme configuration. + * + * @ticket 64442 + */ + public function test_html5_script_support_always_true() { + // Should be true even without any theme support registered. + remove_theme_support( 'html5' ); + $this->assertTrue( current_theme_supports( 'html5', 'script' ) ); + + // Should still be true after adding other html5 types but not script. + add_theme_support( 'html5', array( 'comment-form' ) ); + $this->assertTrue( current_theme_supports( 'html5', 'script' ) ); + + // Other types should still work normally. + $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) ); + $this->assertFalse( current_theme_supports( 'html5', 'search-form' ) ); + } + /** * @ticket 51390 * From 4d295dce3e591dc8a91e838ba2b512c3c06371d4 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 10:14:16 +0100 Subject: [PATCH 2/9] Update comment and add since annotation --- src/wp-includes/theme.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index b870f9cae6c5c..ba415ddc40799 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -3146,6 +3146,7 @@ function _remove_theme_support( $feature ) { * @since 2.9.0 * @since 5.3.0 Formalized the existing and already documented `...$args` parameter * by adding it to the function signature. + * @since 7.0.0 HTML5 script support will always report `true`. * * @global array $_wp_theme_features * @@ -3194,7 +3195,7 @@ function current_theme_supports( $feature, ...$args ) { */ $type = $args[0]; - // HTML5 script support is always enabled since non-HTML5 script output was removed in 7.0. + // Non-HTML5 script support is deprecated. HTML5 script support is always enabled. if ( 'html5' === $feature && 'script' === $type ) { return true; } From fc5bd416d57a2a782f950dcaa98cff4b59831d9c Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 10:19:10 +0100 Subject: [PATCH 3/9] Remove extraneous assertions --- tests/phpunit/tests/theme/support.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/phpunit/tests/theme/support.php b/tests/phpunit/tests/theme/support.php index e765a1fce1079..7625422d7d70f 100644 --- a/tests/phpunit/tests/theme/support.php +++ b/tests/phpunit/tests/theme/support.php @@ -153,14 +153,6 @@ public function test_html5_script_support_always_true() { // Should be true even without any theme support registered. remove_theme_support( 'html5' ); $this->assertTrue( current_theme_supports( 'html5', 'script' ) ); - - // Should still be true after adding other html5 types but not script. - add_theme_support( 'html5', array( 'comment-form' ) ); - $this->assertTrue( current_theme_supports( 'html5', 'script' ) ); - - // Other types should still work normally. - $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) ); - $this->assertFalse( current_theme_supports( 'html5', 'search-form' ) ); } /** From ff6bc027035be20a310be3252dbc9209bacf1f1f Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 10:26:36 +0100 Subject: [PATCH 4/9] Add since annotation --- src/wp-includes/theme.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index ba415ddc40799..1ebf133fe391d 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -2645,6 +2645,7 @@ function get_theme_starter_content() { * @since 6.5.0 The `appearance-tools` feature enables a few design tools for blocks, * see `WP_Theme_JSON::APPEARANCE_TOOLS_OPT_INS` for a complete list. * @since 6.6.0 The `editor-spacing-sizes` feature was added. + * @since 7.0.0 Deprecated the `html5` feature 'script'. * * @global array $_wp_theme_features * From a52d609848ec6c9bad9c48d904daa784f319c509 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 10:26:49 +0100 Subject: [PATCH 5/9] Remove redundant script from default theme supports --- src/wp-includes/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 1ebf133fe391d..d0e2bca0266cf 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4403,7 +4403,7 @@ function _add_default_theme_supports() { * (which use default template functions) and `[caption]` and `[gallery]` shortcodes. * Other blocks contain their own HTML5 markup. */ - add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'search-form', 'gallery', 'caption', 'style', 'script' ) ); + add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'search-form', 'gallery', 'caption', 'style' ) ); add_theme_support( 'automatic-feed-links' ); add_filter( 'should_load_separate_core_block_assets', '__return_true' ); From 6423810197435b234e3ebc425a7c5f6aa3ee356a Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 10:42:09 +0100 Subject: [PATCH 6/9] Add theme supports schema REST API test --- tests/phpunit/tests/rest-api/rest-themes-controller.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/phpunit/tests/rest-api/rest-themes-controller.php b/tests/phpunit/tests/rest-api/rest-themes-controller.php index 923e7cda27374..4d7d221799ead 100644 --- a/tests/phpunit/tests/rest-api/rest-themes-controller.php +++ b/tests/phpunit/tests/rest-api/rest-themes-controller.php @@ -429,7 +429,13 @@ public function test_get_item_schema() { $this->assertArrayHasKey( 'editor-spacing-sizes', $theme_supports ); $this->assertArrayHasKey( 'editor-styles', $theme_supports ); $this->assertArrayHasKey( 'formats', $theme_supports ); + $this->assertArrayHasKey( 'html5', $theme_supports ); + $this->assertSame( + array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ), + $theme_supports['html5'] + ); + $this->assertArrayHasKey( 'post-thumbnails', $theme_supports ); $this->assertArrayHasKey( 'responsive-embeds', $theme_supports ); $this->assertArrayHasKey( 'title-tag', $theme_supports ); From 21ba9e3594ee3859145ccd626d888a447a3fc945 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 11:45:46 +0100 Subject: [PATCH 7/9] Use get_theme_support() in current_theme_supports() Remove direct access of global directly --- src/wp-includes/theme.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index d0e2bca0266cf..5f5d58a69e0af 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -3149,28 +3149,26 @@ function _remove_theme_support( $feature ) { * by adding it to the function signature. * @since 7.0.0 HTML5 script support will always report `true`. * - * @global array $_wp_theme_features - * * @param string $feature The feature being checked. See add_theme_support() for the list * of possible values. * @param mixed ...$args Optional extra arguments to be checked against certain features. * @return bool True if the active theme supports the feature, false otherwise. */ function current_theme_supports( $feature, ...$args ) { - global $_wp_theme_features; - if ( 'custom-header-uploads' === $feature ) { return current_theme_supports( 'custom-header', 'uploads' ); } - if ( ! isset( $_wp_theme_features[ $feature ] ) ) { + $feature_support = get_theme_support( $feature, ...$args ); + + if ( ! $feature_support ) { return false; } // If no args passed then no extra checks need to be performed. if ( ! $args ) { /** This filter is documented in wp-includes/theme.php */ - return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + return apply_filters( "current_theme_supports-{$feature}", true, $args, $feature_support ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores } switch ( $feature ) { @@ -3180,11 +3178,11 @@ function current_theme_supports( $feature, ...$args ) { * by passing an array of types to add_theme_support(). * If no array was passed, then any type is accepted. */ - if ( true === $_wp_theme_features[ $feature ] ) { // Registered for all types. + if ( true === $feature_support ) { // Registered for all types. return true; } $content_type = $args[0]; - return in_array( $content_type, $_wp_theme_features[ $feature ][0], true ); + return in_array( $content_type, $feature_support[0], true ); case 'html5': case 'post-formats': @@ -3201,13 +3199,13 @@ function current_theme_supports( $feature, ...$args ) { return true; } - return in_array( $type, $_wp_theme_features[ $feature ][0], true ); + return in_array( $type, $feature_support[0], true ); case 'custom-logo': case 'custom-header': case 'custom-background': // Specific capabilities can be registered by passing an array to add_theme_support(). - return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] ); + return ( isset( $feature_support[0][ $args[0] ] ) && $feature_support[0][ $args[0] ] ); } /** @@ -3222,7 +3220,7 @@ function current_theme_supports( $feature, ...$args ) { * @param array $args Array of arguments for the feature. * @param string $feature The theme feature. */ - return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + return apply_filters( "current_theme_supports-{$feature}", true, $args, $feature_support ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores } /** From 8ffcd66578c0ad7fbe562df1d00010befa6437a5 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 11:47:51 +0100 Subject: [PATCH 8/9] Move custom-header-uploads override to get_theme_support --- src/wp-includes/theme.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 5f5d58a69e0af..1a32390d55666 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -3031,6 +3031,10 @@ function _custom_logo_header_styles() { function get_theme_support( $feature, ...$args ) { global $_wp_theme_features; + if ( 'custom-header-uploads' === $feature ) { + return get_theme_support( 'custom-header', 'uploads' ); + } + if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } @@ -3155,10 +3159,6 @@ function _remove_theme_support( $feature ) { * @return bool True if the active theme supports the feature, false otherwise. */ function current_theme_supports( $feature, ...$args ) { - if ( 'custom-header-uploads' === $feature ) { - return current_theme_supports( 'custom-header', 'uploads' ); - } - $feature_support = get_theme_support( $feature, ...$args ); if ( ! $feature_support ) { From 15176fc25c47268b84171a1a437ca1afffca03a9 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 13 Feb 2026 11:56:26 +0100 Subject: [PATCH 9/9] Revert "Move custom-header-uploads override to get_theme_support" This reverts commit 8ffcd66578c0ad7fbe562df1d00010befa6437a5. --- src/wp-includes/theme.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 1a32390d55666..5f5d58a69e0af 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -3031,10 +3031,6 @@ function _custom_logo_header_styles() { function get_theme_support( $feature, ...$args ) { global $_wp_theme_features; - if ( 'custom-header-uploads' === $feature ) { - return get_theme_support( 'custom-header', 'uploads' ); - } - if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } @@ -3159,6 +3155,10 @@ function _remove_theme_support( $feature ) { * @return bool True if the active theme supports the feature, false otherwise. */ function current_theme_supports( $feature, ...$args ) { + if ( 'custom-header-uploads' === $feature ) { + return current_theme_supports( 'custom-header', 'uploads' ); + } + $feature_support = get_theme_support( $feature, ...$args ); if ( ! $feature_support ) {