Should you – as i did – wonder why WordPress renders a bucket of inline CSS into the HTML output (such as --wp--preset--font-size--normal in <html> or --wp--preset--color--white in <body>): This is done to accomodate frontend editing with Gutenberg. If you – as i do – are not using Gutenberg frontend editing, then the following PHP code can be included in the functions.php of a custom theme or the php file of a custom plugin. Sorry, Gutenberg folks – no means no. 🙂
function remove_block_css() {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
}
add_filter('use_block_editor_for_post_type', '__return_false', 10);
add_action('wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_global_styles_and_svg_filters() {
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
remove_action('wp_body_open', 'wp_global_styles_render_svg_filters');
}
add_action('init', 'remove_global_styles_and_svg_filters');
Sources:
- https://wordpress.org/support/topic/how-to-disable-inline-styling-style-idglobal-styles-inline-css/
- https://smartwp.com/remove-gutenberg-css/