Skip to content

#72029 breaks the theme property when fetching /wp-json/wp/v2/templates using the API #72225

@jkmassel

Description

@jkmassel

Description

After the release of 21.8.0 we started getting test failures in wordpress-rs because the schema format for templates had changed.

I've narrowed it down to #72029, specifically this change. This check in #72141 seems to further contribute to the problem, as $post_arr['id'] is never an int for built-in templates.

Step-by-step reproduction instructions

  1. Create a new WordPress site (it should use twentytwentyfive as the theme – this one has templates, so it'll demonstrate the problem)
  2. Set up permalinks
  3. Fetch wp-json/wp/v2/templates
  4. Note that the theme field for each template is twentytwentyfive.
  5. Install the "Gutenberg" plugin (21.8.0 or greater)
  6. Fetch wp-json/wp/v2/templates
  7. Note that the theme field for each template is null
  8. Comment out lines 35-53 (inclusive) in wp-content/plugins/gutenberg/lib/compat/wordpress-6.9/template-activate.php
  9. Fetch wp-json/wp/v2/templates
  10. Note that the theme field for each template is twentytwentyfive.

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 6.8.3
  • Gutenberg 21.8.0

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions