-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
theme.json
properties can't be overridden in PHP
#33367
Comments
As far as I know, |
@aristath I understand conceptually why it’s running late, it just makes the upgrade path unnecessarily complex if you’re migrating from, for example, custom settings pages. |
One other use case I have had in mind is add-on plugins (or even theme/child options). I'm kind of imagining scenarios where I might build a settings page for configuring certain defaults that are not covered by the Global Styles system. Being able to take custom plugin settings, hook in, and overrule Is there even a hook that runs on both the front end and editor for this? I think |
I believe there are plans to filter theme.json values so it can be overridden, but this has not yet been implemented. |
Even if you filter the theme.json the result will be sanitized with the schema from the core, but if you only want to have a dynamic theme.json you can follow this issue #33524 where I linked a library for generating the theme.json from a PHP array. |
I think we can close this issue: PR: #44015 |
Description
theme.json
properties cannot be (easily) overridden on the server-side due to the current implementation of filtering the block editor settings at a priority set toPHP_INT_MAX
.Being able to filter theme.json from PHP is a valuable way to ease the on-ramp to theme.json adoption; for example if a theme includes an existing settings panel for configuring colors and fonts, they may be able to use PHP to insert this configuration into the theme.json file until a global style editor is available to client users.
I would propose updating the filter to hook in at
999
which still conveys that the filter is intended to be run late while still allowing developers the option to adjust without a more complex unhook/rehook dance.The text was updated successfully, but these errors were encountered: