I like to know how I can remove these individually.

<style id='wp-block-separator-inline-css'>
@charset "UTF-8";.wp-block-separator{border-bottom:1px soli ...

WP has a feature to add inline JS and (and also CSS I think) to registered scripts/styles. So dequeue should work, but it does not.

add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\action_wp_enqueue_scripts', 99 );

function action_wp_enqueue_scripts() {

    wp_dequeue_style( 'wp-block-navigation' ); // Comes from a file and works 
    wp_dequeue_style( 'wp-block-post-comments-form' ); // Comes from a file and works 
    wp_dequeue_style( 'wp-block-seperator' ); // Does not work

A hint to where exactly I find in the source on how these are handled would also help.

And BTW, I do not understand why these are handled in this stupid HTML polluting way in the first place. This does not seem to be dynamic for the most part, but FSE Themes are spammed with inline CSS for almost all blocks, only a few are loaded from CSS files. This causes the browser to never cache the CSS for blocks, very inefficient.

Asked the question and made this comment already on Github.

  • 1
    because those are one off properties of a single block, not something a general CSS file and class covers. It's much more efficient to use theme.json to set these parameters
    – Tom J Nowell
    May 16, 2022 at 9:36
  • @TomJNowel You are wrong, these are not "one off properties". They are printed one time and not again for each block, they have an ID. Gutenberg in fact also generates some dynamic one off CSS for group blocks and separator spacing settings based on specific containers that also looks messy but at least has a purpose. I do not see the purpose of this. May 16, 2022 at 9:49
  • Especially with HTTP/2 where HTTP requests mean NOTHING. GB should load these from a 1000 tiny CSS files if it has to, there is no point to inlining all of this, at least I do not see it. And you did not explain why. May 16, 2022 at 9:51
  • My understanding was that you're building a FSE theme, you expected styling/options settings to be loaded and set via a CSS file, but instead saw inline style blocks and want to know why this is the case and how to remove it. Is this correct? I would ask again that you adhere to our code of conduct and avoid aggressive behaviour and language. If your question isn't being understood, try editing it to eliminate misunderstandings.
    – Tom J Nowell
    May 16, 2022 at 12:57
  • 1
    Thanks, @SallyCJ, it was that simple after all. Just a typo ;) Aug 19, 2022 at 6:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.