Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#55681 closed defect (bug) (fixed)

block-templates theme support not present in /themes REST API endpoint

Reported by: grantmkin's profile grantmkin Owned by: timothyblynjacobs's profile 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

Registers the block-templates theme support. This ensures it is included in the theme_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

This ticket was mentioned in Slack in #core by grantmkin. View the logs.


3 years ago

#3 @hellofromTonya
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 @audrasjb
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 @SergeyBiryukov
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.

#10 @TimothyBlynJacobs
3 years ago

  • Owner set to TimothyBlynJacobs
  • Status changed from new to assigned

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.

#13 @SergeyBiryukov
2 years ago

Hi @TimothyBlynJacobs, I see you're listed as the owner. Do you think this PR has anything else to consider, or is it good to go? Would be great to include it in 6.0.1 RC1 tomorrow :)

#14 @TimothyBlynJacobs
2 years ago

Nope, I think it's good to go! Feel free to take it.

#15 @SergeyBiryukov
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 53659:

Themes: Register the block-templates theme feature.

This ensures the feature is included in the theme_supports REST API data for the active theme.

Follow-up to [48171].

Props grantmkin, TimothyBlynJacobs, addiestavlo.
Fixes #55681.

#16 @SergeyBiryukov
2 years ago

In 53661:

Themes: Register the block-templates theme feature.

This ensures the feature is included in the theme_supports REST API data for the active theme.

Follow-up to [48171].

Props grantmkin, TimothyBlynJacobs, addiestavlo.
Merges [53659] to the 6.0 branch.
Fixes #55681.

SergeyBiryukov commented on PR #2675:


2 years ago
#17

Thanks for the PR! Merged in r53659, backported to the 6.0 branch in r53661.

Note: See TracTickets for help on using tickets.