[wp-trac] [WordPress Trac] #61021: REST API: Add stylesheet_uri and template_uri fields to themes endpoint
WordPress Trac
noreply at wordpress.org
Wed Apr 17 00:59:36 UTC 2024
#61021: REST API: Add stylesheet_uri and template_uri fields to themes endpoint
--------------------------+-----------------------------
Reporter: andrewserong | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The `themes` REST API endpoint response currently does not contain the
base urls for the installed theme (or its template if it's a child theme).
This means that it isn't possible to use the REST API in order to
construct relative paths to a theme's directory.
For block editor based features, such as working with background images,
it would be useful to be able to grab the current theme's base URL in
order to be able to construct theme-relative urls.
One neat way to do this is if the response when requesting a particular
theme via the REST API endpoint also included the following:
* `stylesheet_uri` – the URI to the current theme's directory
* `template_uri` — the URI to the parent theme's directory (if a child
theme)
In this way, if someone knows a theme relative path such as `assets
/background-texture.jpg`, within the block editor, the full URI could be
constructed via prepending the `stylesheet_uri` from the REST API
response.
Note: this enhancement request is not to be confused with the existing
`theme_uri` field. That field points to where the theme can be downloaded
from the theme directory, for example, whereas this ticket is proposing
exposing the installed path for the theme as it exists on the hosted site.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61021>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list