-
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
WP 5.9 adds default Duotones before closing the body #38299
Comments
I am seeing this too: Looks to be related to duo tone things, which I am not using. |
That shows me again, before releasing a new Version and/or feature testing is not done carefull and complete and more and more we have to accept the dictation and forcing us using things we can not opt-out, wether what we want. |
I see at the moment: WHY? WHY? WHY? WHY IS THIS DONE?! |
It is possible to test the release candidate and give feedback before an update. This way the whole project can benefit from it.
No one has intentionally broken your site. The bug will surely be fixed in one of the next versions. |
Related:
|
Okay this point goes to you ;)
I've not said, that some one has intentionally broken my site ... Why is WordPress now rolling out global CSS styles in the front-end, regardless of loss, ruin and infirmity? Why, and this has been criticized for months, is there no way to adjust this, sometimes seriously interfering with the content and front-end, by an opt-in or opt-out? |
Hi, Thanks for reporting; As a workaround, you can disable the default colors by disabling the global styles. |
Awww, Why closing? This is really not the same thing as in #24684. Closing this issue and your answer @skorasaurus shows again, that it does not really make sense to report issues and leave critical comments. Ciao. |
If you can clarify how this issue is different, I would appreciate it so then I'd know to reopen it. On second review, you mentioned the inclusion of SVG files although that is also mentioned at #37927. Both issues discuss that extra CSS global styles (that define colors) are included in the page even when the default color palette is disabled and that behavior is unexpected. |
@skorasaurus It seems like @mkkeck issue is different from #37927 as it appears @mkkeck doesn't want the SVG inserted at all. Not even one instance, as they're not using duotone. I don't even believe they're experiencing the duplicate issue. The issue you cited is someone reporting multiple, duplicate STYLE and SVG insertions within the HTML. They don't seem to have any objection to the STYLE and SVG inserted, as long as there's only one proper instance. @mkkeck appears to want some method or filter to disable the SVG footer output to keep their HTML clean. There doesn't appear to be a way to disable/deactivate this like you would other filters. For instance, you could use something like the following to prevent the add_filter( 'wp_lazy_loading_enabled', '__return_false' ); But there's no equivalent for preventing the SVG HTML from being inserted into the footer of every page and post AFAIK. It's being inserted whether or not there's any block on the page that has duotone enabled. If you're not using duotone, its existence within the HTML serves no purpose. |
|
@Kovalchik8 Your code doesn't remove the SVG code from the footer. The duotone SVG HTML is still inserted on every page and post. A few days ago, someone also posted on the wordpress support forums that this filter removal no longer works: |
This issue is another new
Yes that's correct, but it's another building site. This issue here exists since WP 5.9 only and has nothing to do with default color palette. If I don't want and not have configured or have disabled the duotone and blockGap settings, than I don't want, that WordPress bloats the rendered HTML for the frontend with styles and SVGs, which never used, before closing the body. Reading the reported issue and comparing with changelogs may be help, before simple closing and reporting issues are duplicate of an existing one. |
I've disabled global styles :) I've also added follow lines in my functions.php to remove the wp-container- styles produced by blockGap and the duotone-styles: remove_filter('render_block', 'wp_render_duotone_support');
remove_filter('render_block', 'wp_restore_group_inner_container');
remove_filter('render_block', 'wp_render_layout_support_flag'); But the junk SVG can not be removed at the moment, missing an action/ filter to remove them. The problem is: // file: wp-includes/block-supports/duotone.php;
// line: #459 ... 467
// produces the junk SVG, even if duot0ne is not used.
// Other point: Why fallbacks for stupid Safari,
// which force other browsers to load this junk?
add_action(
// Safari doesn't render SVG filters defined in data URIs,
// and SVG filters won't render in the head of a document,
// so the next best place to put the SVG is in the footer.
is_admin() ? 'admin_footer' : 'wp_footer',
function () use ( $svg ) { echo $svg; }
); |
The duotone and blockGap stuff should perhabs moved from the WordPress core to the Twenty-themes. |
Hi @mkkeck Try this :
|
Thanks for your feedback. I think, this would not remove the duotone SVGs. There's a hardcoded action in file |
Oh ! Are you sure ? I have the same problem and I don't see the duotone SVGs anymore with these actions removed. |
Ok, I will give it a try, when I'm in office. |
WP 5.9 |
I reopen the issue. I can reproduce it withe a new theme. {
"settings": {
"color": {
"duotone": [],
"customDuotone": false
}
}
} We have |
This removes the SVGs :) I've added now to my theme add_action('after_setup_theme', function() {
// remove SVG and global styles
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
// remove wp_footer actions which add's global inline styles
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
// remove render_block filters which adding unnecessary stuff
remove_filter('render_block', 'wp_render_duotone_support');
remove_filter('render_block', 'wp_restore_group_inner_container');
remove_filter('render_block', 'wp_render_layout_support_flag');
}); |
It's not only adding Duotones, the styles for each wp-container-idxxxx of the blockGap feature, which is disabled in my theme, is also added. So that's why I've said "WP 5.9 adds junk before closing the body". There should nothing overwritten, replaced or added or merged with WP global styles, which can break existing themes. |
Others have already pointed this out but I wanted to reiterate the point. It seems very weird to me that the decision to output an extra ~260lines of HTML worth of SVG filters on every page, regardless of whether duotone's have been disabled in theme.json (or even if a block is used on a page!) was allowed to go live and still hasn't been fixed after months. No wonder a lot of WP sites rank badly on pagespeed insights. This is bad for hosting costs, users data, page speed scores and green credentials. This filter removed it for me, thanks @vralle.
The SVGs were being output just after the opening tag for me - ~260 lines of HTML added to every page completely unnecessarily! |
As noted in this blog post, you can now set |
Tested and can confirm that this works now. Update |
My theme.json that worked for anyone running into this. |
Mine WP version is |
Hello, I removing all --wp prefix. Im not using blocks.css :)
|
We've attempted at a fix for this in #49103 which should make it into the Gutenberg 15.5 release. The All global styles are handled by duotone block supports now instead of being part of the global styles stylesheet. It was a rather involved change, so please open an issue if you run into any unexpected side-effects of moving these styles around. |
I wrote a little script, and added it to the functions.php file of my child theme. For me this worked. Just be careful, in case you add this to your core theme that it won't get updated. So you may want to write an extra script to call this as a php file when not using a childtheme. add_action( 'wp_footer', 'remove_wp_filters', 10 );
function remove_wp_filters() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('svg').filter(function() {
return this.innerHTML.indexOf('wp-duotone') !== -1;
}).remove();
});
</script>
<?php
} |
Description
I've updated my WP to 5.9. Now there is new junk added before
</body>
, some SVG's and Style's.This does not make sense, because I'm not using FSE and have disabled duotone and gradients.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
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
The text was updated successfully, but these errors were encountered: