Disable global-styles-inline-css in WordPress

Last updated:

WordPress 5.9 or later, this page explains how to disable global-styles-inline-css, which is now output in the head.

Global styles output in head?

Since WordPress 5.9, global styles are output from wp_head().

Even classic themes that do not use theme.json will load global styles.

<style id="global-styles-inline-css">
body{--wp--preset--color--black: #000000;...}
</style>

Please refer to the following pages for more information on classic and block themes.

Disable global-styles-inline-css

Add the following code to functions.php of the theme you are using.

add_action( 'wp_enqueue_scripts', 'remove_global_styles' );
function remove_global_styles(){
    wp_dequeue_style( 'global-styles' );
}
go to top