get_root_layout_rules: remove unnecessary call to sanitize_title#53568
Conversation
The layout definitions are static and defined by the code, so there is no need to sanitize them.
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/class-wp-theme-json-gutenberg.php |
andrewserong
left a comment
There was a problem hiding this comment.
Nice follow-up 👍
✅ Removing sanitize_title here sounds safe to me, as we can always expect gutenberg_get_layout_definitions to return a safe classname, as you mention
✅ Smoke tested on my test site that block-level and root layout classnames continue to be output as expected
LGTM! ✨
Part of #45171
Extracted from #53351
What
This removes an unnecessary call to
sanitize_title.Why
When this was introduced at #40875 layout definitions were taken from
theme.json(user modifiable), so sanitization was required. Now, the layout definitions are static, so we no longer need this.I took a profile from loading the "hello world" post in a site that uses TwentyTwentyThree. I don't expect this to have big performance wins, though it's a small and fast win.
Testing Instructions
Verify tests pass.