HTML5 script support is always true#10919
Conversation
…n 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
Outdated
| */ | ||
| $type = $args[0]; | ||
|
|
||
| // HTML5 script support is always enabled since non-HTML5 script output was removed in 7.0. |
There was a problem hiding this comment.
| // HTML5 script support is always enabled since non-HTML5 script output was removed in 7.0. |
b3e070a to
4d295dc
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
This turns out to be messier than expected, largely because I think the cleanest way to implement this is to have wordpress-develop/src/wp-includes/theme.php Lines 3030 to 3050 in d3b793f wordpress-develop/src/wp-includes/theme.php Lines 3157 to 3203 in d3b793f The alternative is to leave this as is (close this PR without landing). These checks are infrequent in plugins. |
Remove direct access of global directly
This reverts commit 8ffcd66.
Since non-HTML5 script output was completely removed in r61415, 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()andremove_theme_support()remains unchanged.Only the check via
current_theme_supports( 'html5', 'script' )is affected.Theme REST API calls to remain unchanged:
get_theme_support()behavior is unchanged at this time socurrent_theme_supports()may be incoherent. Additionally if nohtml5support is enabled for a theme,scriptsupport remains false. REST API theme response inherits this strange behavior because it relies on bothget_theme_support()andcurrent_theme_supports(). Details in #10919 (comment).Trac ticket: https://core.trac.wordpress.org/ticket/64442
Use of AI Tools
The basic implementation was performed by Claude Code. I performed full review and adaptation of the changes.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.