Skip to content
6 changes: 6 additions & 0 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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':
Expand Down
22 changes: 22 additions & 0 deletions tests/phpunit/tests/theme/support.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Loading