-
Notifications
You must be signed in to change notification settings - Fork 4.7k
REST API: add has_theme_json field to WP_REST_Themes_Controller class #69857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
Size Change: -17 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
The current code will register the field for every theme item, not just the active one. What's the reason for the active theme limitation? The |
|
I'm not familiar with REST API, but do you mean that we should expose both |
|
I guess we should expose this in a similar manner to |
|
I believe this is also needed for #69873 |
|
Maybe I don't fully understand the problem with this PR.
|
|
The problem here is that We either have to limit Fetch collection: Screenshots |
Thank you, I was able to understand what the problem was in this PR! I'd like to explore another approach. |
|
After thinking about this problem, I decided that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the theme API integration in the site editor by replacing the temporary use of the settings.supportsLayout field with the new currentTheme.has_theme_json field. Key changes include replacing the legacy field in the SiteHub component, updating utility functions in the theme route, and cleaning up unused editorSettings in the App component.
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/edit-site/src/components/site-hub/index.js | Updated to use currentTheme.has_theme_json instead of settings.supportsLayout |
| packages/edit-site/src/components/site-editor-routes/utils.js | Replaced the temporary editorSettings field with currentTheme.has_theme_json |
| packages/edit-site/src/components/app/index.js | Removed the unused editorSettings field and updated derived data |
| backport-changelog/6.9/8665.md | Added changelog entries referencing related PRs and tickets |
Files not reviewed (2)
- lib/compat/wordpress-6.9/rest-api.php: Language not supported
- lib/load.php: Language not supported
|
Flaky tests detected in f72b668. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/14335728615
|


What?
Core ticket: https://core.trac.wordpress.org/ticket/63253
See: #68036 (comment)
Why?
Currently, we are exposing Stylebook for the classic theme by checking the value of
supportsLayoutas one of the conditions. However, there is no guarantee that this setting will remain equivalent towp_theme_has_theme_json()in the future.We should expose the new
has_theme_jsonfield via the theme REST API.How?
Add a new
has_theme_jsonfield to theWP_REST_Themes_Controllerclass.Testing Instructions
wp.data.select('core').getCurrentTheme()in the browser console.has_theme_jsonfield.