-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Duotone: Avoid rendering duplicate stylesheet and SVG #33233
Conversation
lib/block-supports/duotone.php
Outdated
) | ||
); | ||
add_filter( 'render_block', 'gutenberg_render_duotone_support', 10, 2 ); | ||
// This can be removed when plugin support requires WordPress 5.8.0+. |
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.
This basically uses the wp-code if it is present. It makes future changes in the plugin impossible to do because the core version is going to be used. Could we remove the core filters instead if they are present?
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.
Makes sense. I'll update the code.
This is a pattern I've seen before in Gutenberg core and the only reason I've used it here.
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.
Done ✅
P.S. I pushed a similar fix for Group Block layout support. Do you want me to update logic there as well to use remove_filter
?
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.
Tested locally, and it's working fine for me!
Description
Adds check to avoid rendering duplicate stylesheet and SVG elements when the plugin is used with WP 5.8.
How has this been tested?
Screenshots
Types of changes
Bugfix
Checklist:
*.native.js
files for terms that need renaming or removal).