[wp-block-themes]: document theme.json slug-normaliser bug class#59
Open
mikeyarce wants to merge 1 commit into
Open
[wp-block-themes]: document theme.json slug-normaliser bug class#59mikeyarce wants to merge 1 commit into
mikeyarce wants to merge 1 commit into
Conversation
WordPress passes every preset/custom slug through _wp_to_kebab_case() before emitting its CSS var, hyphenating at digit/letter boundaries and camelCase transitions. Handwritten references to the un-normalised form silently fall back, making the failure invisible without computed-style inspection. Adds a "Slug normalisation gotcha" section to theme-json.md (with a grep pattern for catching un-normalised references) and a cross-referenced bullet under debugging.md § "Styles not applying". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @mikey.arce@principalwp.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents a silent failure in theme.json: WordPress hyphenates preset/custom slugs before emitting CSS vars, so a handwritten
var()reference to the un-normalised slug resolves to nothing and quietly falls back. No error, layout looks roughly right — invisible without computed-style inspection.Examples:
3xl→--wp--preset--font-size--3-xlcardShadow→--wp--custom--card-shadowUnder the hood,
WP_Theme_JSONruns every slug through_wp_to_kebab_case(), which splits at digit/letter boundaries, camelCase transitions, and non-alphanumeric characters.Changes
skills/wp-block-themes/references/theme-json.md— new "Slug normalisation gotcha" section with the explanation and a grep pattern for catching un-normalised references.skills/wp-block-themes/references/debugging.md— new bullet under "Styles not applying" pointing at the gotcha section.