Repository navigation
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the ⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. As a site builder, I want to insert a core navigation overlay pattern with CTA and see it on the frontend in
|
3529bc2 to
f01a194
Compare
The core icons bundled with the plugin are trusted, and sanitizing them with wp_kses() is the main cost of rendering them.
f01a194 to
f6c20f8
Compare
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR! This is essentially a performance improvement that speeds up loading the core SVG icons, and it doesn't introduce any new APIs, so it would be nice to get it into the 7.2 release.
Overall, it looks good. I left two comments on the core PR:
As a side note, the core icons are already guaranteed to be safe by a unit test. If any harmful code were ever introduced into a core icon, this test would fail:
gutenberg/phpunit/class-wp-icons-registry-gutenberg-test.php
Lines 531 to 542 in 0dabb1c
What?
Skips the
wp_kses()sanitization of the core icons bundled with the plugin, inpackages/icons/src/library.Core backport: WordPress/wordpress-develop#14492
Why?
WordPress/wordpress-develop#12270 renders the admin bar and admin menu icons with
wp_get_icon(), so every wp-admin page now loads about 20 icons through the registry. Measurements on that PR show about +3.5 ms of server time per wp-admin page, and most of the icon cost iswp_kses().The core icons ship with the plugin and are as trusted as its PHP files, so sanitizing them does not really protect anything.
How?
WP_Icons_Registry_Gutenberg::get_content()skipssanitize_icon_content()when the icon file is inside the core icon library.Testing Instructions
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: code generation, with my supervision.