Search code examples
wordpresswordpress-gutenberg

WordPress 5.9 inserting unwanted duotone SVGs and CSS variables


I've noticed in the recent WordPress update that global CSS variables and SVGs are embeded into the frontend header and footer.

CSS variables: enter image description here

SVGs: enter image description here

This is a lot of unwanted junk that we do not need. I'm looking for a way to remove these all together, I can't find anything in the release notes.


Solution

  • While writing this question I have stumbled upon the below...

    Removal of CSS variables

    Adding this to your theme will do the job:

    add_action( 'wp_enqueue_scripts', function() {
        wp_dequeue_style( 'global-styles' );
    } );
    

    Removal of SVGs

    First (if you haven't already) create a theme.json file in your theme folder and add the below:

    {
      "version": 1,
      "settings": {
        "color": {
          "duotone": null
        }
      }
    }