Repository navigation
Conversation
Build external stylesheet links with WP_HTML_Tag_Processor and expose wp_style_attributes. Migrate Core stylesheet link emitters while preserving legacy filters and add API and integration coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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. |
|
Closing in favor of three PRs, which split this change so that it can be committed in separate changesets, and incorporate feedback from #13250 and Core-51325:
The functions are renamed to Generated by Claude Code |
Adds
wp_get_stylesheet_link_tag()andwp_print_stylesheet_link_tag()backed byWP_HTML_Tag_Processor, with thewp_style_attributesfilter for applying attributes such as CSP nonces. Core stylesheet links now use the API acrossWP_Styles(including RTL/alternate output), concatenated admin styles, thewp_admin_css()fallback, locale and media-preview styles, compatibility markup, and Twenty Ten/Twenty Eleven (with older-Core fallbacks).Raw URLs are passed to the tag processor for escaping and protocol checks. The legacy
style_loader_tagandwp_admin_cssfilters remain in their existing order;style_loader_tagkeeps its escaped$hrefargument. Concatenated output gets the new attribute filter once and does not newly invokestyle_loader_tag.Validation:
./vendor/bin/phpunit tests/phpunit/tests/dependencies/wpStylesheetLinkTag.php- passed (6 tests, 7 assertions)../vendor/bin/phpunit tests/phpunit/tests/dependencies/styles.php- passed (84 tests, 209 assertions).php -lon both stylesheet test files, targeted PHPCS on both test files, andgit diff --check- passed.Trac ticket: https://core.trac.wordpress.org/ticket/51325 (related context only; this is a separate external stylesheet-link follow-up, not a change to that ticket's inline-style scope).
Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): GPT-6 Luna
Used for: Architecture analysis, API implementation, Core call-site migration, and tests; reviewed and validated in the isolated WordPress Core worktree.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this PR. See GitHub Pull Requests for Code Review in the Core Handbook for more details.