[wp-trac] [WordPress Trac] #64402: REST API: Block themes without theme.json cannot use global styles
WordPress Trac
noreply at wordpress.org
Thu Dec 11 11:47:30 UTC 2025
#64402: REST API: Block themes without theme.json cannot use global styles
--------------------------+-----------------------------
Reporter: wildworks | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In Gutenberg, the global styles data is obtained as follows:
- Send a request to the theme endpoint (`/wp/v2/themes`)
- Derive the global styles ID from the `_links` from the response data
- Use that ID to retrieve the global styles data
[https://github.com/WordPress/gutenberg/blob/50d415f66e240205bdbe546da343acb223c460aa/packages
/core-data/src/resolvers.js#L717-L736 Source]
On the backend, if a global styles ID is available, a link to it is added
[https://github.com/WordPress/wordpress-
develop/blob/63b3a8f6c874c8dd7cec0400edf3135ad98f649d/src/wp-includes
/rest-api/endpoints/class-wp-rest-themes-controller.php#L411-L415 here].
However, the `get_user_data_from_wp_global_styles` function returns an
empty array if the theme does not have a theme.json, even if it is a block
theme ([https://github.com/WordPress/wordpress-
develop/blob/6b7adc0159731f2dc23719d52b1add89d1cd1703/src/wp-includes
/class-wp-theme-json-resolver.php#L490 Source]). As a result, no link is
added to the theme endpoint, and Gutenberg fails to access the global
styles data.
The block theme should be determined purely by the `wp_is_block_theme()`
function, regardless of whether a `theme.json` is present.
Links to the global styles id should be exposed even to block themes that
do not have a `theme.json`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64402>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list