Making WordPress.org

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: tomdevisser's profile tomdevisser 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

https://developer.wordpress.org/themes/core-concepts/global-settings-and-styles/#theme-json-structure

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": []
}

Change History (2)

#1 @tomdevisser
4 weeks ago

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:

The latest version is 2 and can always be found in the theme.json Living Reference…

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.

This ticket was mentioned in Slack in #docs by sandeep_dahiya. View the logs.


4 weeks ago

Note: See TracTickets for help on using tickets.