Opened 4 weeks ago
Last modified 4 weeks ago
#8011 new enhancement
Update theme.json example in Theme Handbook to use version 3 and correct data structure
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Component: | Handbooks | Keywords: | |
Cc: |
Description
Issue Description
The Theme Handbook page on theme.json currently shows an outdated and partially incorrect example structure. The sample uses version 2, while the current recommended version is 3. Additionally, both customTemplates
and templateParts
are shown as objects, but they should be arrays.
URL of the Page with the Issue
Why is this a problem?
This outdated and incorrect example may mislead theme developers, especially those new to working with theme.json. Using the wrong version or incorrect data structures can result in unexpected behaviour or errors when registering templates or parts, leading to frustration and unnecessary debugging.
Suggested Fix
Update the example to reflect the current standard format, using version 3, and ensure that both customTemplates
and templateParts
are shown as arrays. For example:
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 3, "settings": {}, "styles": {}, "customTemplates": [], "templateParts": [], "patterns": [] }
Just a quick follow-up — in addition to the example needing an update, there are other outdated references on the page. For example, right below the theme.json sample, the description for version still states:
This should be updated to reflect that version 3 is now the latest. There may be other similar mentions elsewhere in the Theme Handbook worth reviewing for consistency.