Archived topic
Wordpress 5.9.1 SVG code bug solution
8 replies · Started by Rostyslav on February 22, 2022
Hello, after update I see this svg hidden elements on my website: https://ibb.co/YhcDx2r
How can I delete it?
Hi there,
I believe that's a WP core bug:
https://github.com/WordPress/gutenberg/issues/38299
Thanks Leo!
My first thought was virus.
No problem :)
Hi
I think these svg comes from the FSE Global Styles, are present in 5.9 too, and are in head and footer.
To disable it if you don´t need:
1.- If autoptimize is used, in extra tab have an option to disable.
2.- In a child theme, you can put this code in funtions.php
add_action('after_setup_theme', function () {
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
}, 10, 0);
P.D. Seems that 5.9.1 need some extra:
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
Thanks for sharing!
Thanks Longinos!!!
With whis function the problem was solved : remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
This my cleanup:
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
remove_action( 'render_block', 'wp_render_duotone_support', 10 );
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
bye
Thanks for sharing!