-
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
settings.color.duotone = null does not validate against theme.json schema #40383
Comments
I have encountered the same problem. The output of SVG duotones in head also is affected by this. Passing an empty array to disable duotone will still generate them. Null generates error. I had to resort to using the php function to remove these. |
Ref: https://jira.greenpeace.org/browse/PLANET-6811 Ref: WordPress/gutenberg#40383 --- Our current `theme.json` option doesn't work in 6.0. You will probably see a validation error in your editor, because `null` is not yet reflected in the official schema, but it does seem to work without issues.
Ref: https://jira.greenpeace.org/browse/PLANET-6811 Ref: WordPress/gutenberg#40383 --- Our current `theme.json` option doesn't work in 6.0. You will probably see a validation error in your editor, because `null` is not yet reflected in the official schema, but it does seem to work without issues.
This is the correct way to disable duotone filters // theme.json
{
"settings": {
"color": {
// This clears the duotone palette for the theme
"duotone": [],
// This removes the default duotone filters from the UI
"defaultDuotone": false,
// This disables the ability to set a custom duotone filter
"customDuotone": false
}
}
} Using all three options for Even after all of that, there will still be the SVGs for the default filters output at the beginning of the // Removes generation from core
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
// Removes generation from the gutenberg plugin
remove_action( 'wp_body_open', 'gutenberg_global_styles_render_svg_filters' ); Finally, Hopefully that clarifies things. Keep an eye on #38299 for changes to the SVG generation for default filters. I'd like a better solution for block patterns rather than always including all of the defaults, and that issue is where updates on that problem will be posted. |
Thanks for this very good answer, @ajlende. I can confirm that even in WP 6.1, the |
Description
After reviewing a number of issues including #31764, #33295, #35931, and #38299, I believe that the following two
theme.json
values are required to fully disable the custom duotone feature:settings.color.duotone
:null
removes the SVG filters output in the body field. Setting this property to an empty array ([]
) does not work.settings.color.customDuotone
: removes the UI toolbar control in combination with the first changeHowever, when I try to validate my
theme.json
, there is an error forsettings.color.duotone
:null
:Prior to WordPress 5.9.3, the null value also seemed to cause a PHP error, but I believe that has been resolved.
So first: Is this the correct way to fully disable duotone support with
theme.json
.If so:
null
forsettings.color.duotone
-OR- using[]
as the value for that setting should prevent the SVG filters from being outputStep-by-step reproduction instructions
Validate the following
theme.json
file:Screenshots, screen recording, code snippet
No response
Environment info
WordPress 5.9.3
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: