Title: Remove SVG FIlter
Last modified: February 3, 2022

---

# Remove SVG FIlter

 *  [Colir](https://wordpress.org/support/users/colir/)
 * (@colir)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/remove-svg-filter/)
 * Hello,
    i’m looking for a way to remove svg filter that are printed in wp_footer
   since WP 5.9
 *     ```
       <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 0 0" width="0" height="0" focusable="false" role="none" style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" ><defs><filter id="wp-duotone-dark-grayscale">...
       ```
   
 * Thank you very much

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Teddy Patriarca](https://wordpress.org/support/users/tykoted/)
 * (@tykoted)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/remove-svg-filter/#post-15326929)
 * It’s a known issue right now for the block editor, and it will be fixed in the
   future release.
 * [https://github.com/WordPress/gutenberg/issues/38299](https://github.com/WordPress/gutenberg/issues/38299)
 * There’s a workaround. If you are **not** using the block editor, you can add 
   this code to your theme’s functions.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);
       ```
   
 * However, if you use the block editor, the workaround above can break some of 
   your page’s styling. If that happens, I suggest using this code instead (in your
   theme’s functions.php).
 *     ```
       add_action('wp_footer',function() {
               global $wp_filter;
   
               if(empty($wp_filter['wp_footer'][10])) return;
   
               foreach($wp_filter['wp_footer'][10] as $hook) {
                       if(!is_object($hook['function']) || get_class($hook['function']) !== 'Closure') continue;
   
                       $static=(new ReflectionFunction($hook['function']))->getStaticVariables();
   
                       if(empty($static['svg'])) continue;
   
                       if(!str_starts_with($static['svg'],'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 0 0" ')) continue;
   
                       remove_action('wp_footer',$hook['function'],10);
               }
       },9);
       ```
   
 *  Thread Starter [Colir](https://wordpress.org/support/users/colir/)
 * (@colir)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/remove-svg-filter/#post-15327201)
 * Thank you.
    I’ll try this next week.
 *  [Cambabutonono](https://wordpress.org/support/users/cambabutonono/)
 * (@cambabutonono)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/remove-svg-filter/#post-15359713)
 * That workaround works! Removes both default inline css and the filters from the
   footer.
 * Not sure why all that garbage is included by default anyway, should be added 
   by a theme imho.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remove SVG FIlter’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Cambabutonono](https://wordpress.org/support/users/cambabutonono/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/remove-svg-filter/#post-15359713)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
