Stop WordPress loading Gutenberg Styles

If you want to stop WordPress from loading in the styles that come along with Gutenberg, this one’s for you. Just be sure to add in your styles and scripts, if you’re loading them this way.

  Disable Gutenberg styles
function your_theme_styles_and_scripts() {
  // Add all of your styles and scripts you'd normally load in
  wp_enqueue_style('site_css', get_template_directory_uri() . '/your-css-file.css');
  wp_enqueue_script('sice_js', get_template_directory_uri() . '/your-js-file.js');

  // De-register Gutenberg styles
add_action('wp_enqueue_scripts', 'your_theme_styles_and_scripts');

(Note: The above code works, but is simplified. Read the docs to see how to expand this to suit your needs)

It’s worth noting that WP doesn’t seem to load in any JavaScript specific to Gutenberg, by default anyway.

As a little extra speed bonus, you can stop WordPress loading a JavaScript file that expands plain raw links like (i.e. pasting the URL and not changing the text of the link, so the visitor sees the whole URL) from services like Twitter or YouTube into fully functional embeds, add this into the function above:

// De-register wp-embed

And just like that, you’ve cleaned up the code, and removed 3 extra requests, not counting any requests that embeds will ask for. Score!