#55681 closed defect (bug) (fixed)
block-templates theme support not present in /themes REST API endpoint
| Reported by: | grantmkin | Owned by: | TimothyBlynJacobs |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.0.1 |
| Component: | Themes | Version: | 5.9 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | rest-api |
Description
The block-templates theme support is not present in the theme_supports REST API data for the active theme.
- Activate a theme that supports block templates, like Twenty Twenty Two
- Access /wp-json/wp/v2/themes?status=active
- See that block-templates is not including in the
theme_supportsdata
Change History (17)
This ticket was mentioned in PR #2675 on WordPress/wordpress-develop by creativecoder.
4 years ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core by grantmkin. View the logs.
4 years ago
TimothyBJacobs commented on PR #2675:
4 years ago
#4
Thanks for the PR @creativecoder,
It looks like we need to update the WP_Test_REST_Themes_Controller::test_get_item_schema test to account for this new theme feature.
creativecoder commented on PR #2675:
4 years ago
#5
Thanks for the pointer @TimothyBJacobs !
I've modified the test... everything looks ✅ now.
#6
@
4 years ago
- Milestone 5.9.4 → 6.1
Moving this ticket to next major release since it wasn't addressed during this cycle. Anyone is welcome to move it back to 6.0.x minor releases cycle if a patch is ready to ship.
#7
@
4 years ago
- Milestone 6.1 → 6.0.1
The patch seems straightforward enough, I think this can be fixed in 6.0.1.
Addison-Stavlo commented on PR #2675:
4 years ago
#8
@TimothyBJacobs @creativecoder - Is there anything else holding this PR back, or is this ready to go?
TimothyBJacobs commented on PR #2675:
4 years ago
#9
Nope, it's on my list to commit @Addison-Stavlo.
agrullon95 commented on PR #2675:
4 years ago
#11
@creativecoder - just for my understanding, can you explain why the block-templates code snippet was place inside the themes.php file and specifically within the create_initial_theme_features function?
creativecoder commented on PR #2675:
4 years ago
#12
@creativecoder - just for my understanding, can you explain why the block-templates code snippet was place inside the themes.php file and specifically within the create_initial_theme_features function?
@agrullon95 Sorry for the delayed reply here. create_initial_theme_features looks to be the place where all theme supports that are recognized by WP Core are registered. While debugging https://core.trac.wordpress.org/ticket/55681, I found that registering a theme support is required to have it show in the API response for the active theme.
The block-templates theme support is used by the editor component (a.k.a. Gutenberg) and it looks like registering it was overlooked when that theme support was introduced.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Registers the
block-templatestheme support. This ensures it is included in thetheme_supportsdata of the active theme in the/wp-json/wp/v2/themes?status=activeendpoint.Trac ticket: https://core.trac.wordpress.org/ticket/55681