#55681 closed defect (bug) (fixed)
block-templates theme support not present in /themes REST API endpoint
Reported by: | grantmkin | Owned by: | TimothyBlynJacobs |
---|---|---|---|
Milestone: | 6.0.1 | Priority: | normal |
Severity: | normal | Version: | 5.9 |
Component: | Themes | Keywords: | has-patch |
Focuses: | rest-api | Cc: |
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_supports
data
Change History (17)
This ticket was mentioned in PR #2675 on WordPress/wordpress-develop by creativecoder.
3 years ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core by grantmkin. View the logs.
3 years ago
#3
@
3 years ago
- Milestone changed from Awaiting Review to 5.9.4
Moving into the 5.9.4 for visibility.
TimothyBJacobs commented on PR #2675:
3 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:
3 years ago
#5
Thanks for the pointer @TimothyBJacobs !
I've modified the test... everything looks ✅ now.
#6
@
3 years ago
- Milestone changed from 5.9.4 to 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
@
3 years ago
- Milestone changed from 6.1 to 6.0.1
The patch seems straightforward enough, I think this can be fixed in 6.0.1.
Addison-Stavlo commented on PR #2675:
3 years ago
#8
@TimothyBJacobs @creativecoder - Is there anything else holding this PR back, or is this ready to go?
TimothyBJacobs commented on PR #2675:
3 years ago
#9
Nope, it's on my list to commit @Addison-Stavlo.
agrullon95 commented on PR #2675:
3 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:
2 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.
Registers the
block-templates
theme support. This ensures it is included in thetheme_supports
data of the active theme in the/wp-json/wp/v2/themes?status=active
endpoint.Trac ticket: https://core.trac.wordpress.org/ticket/55681