• Resolved Vortex11

    (@vd11)


    I will never ever use Gutenberg with the site I’m currently working on and have disabled it everywhere, except for the calls to the related CSS in Storefront. How can I keep the theme from calling for this unneeded CSS?

Viewing 3 replies - 1 through 3 (of 3 total)
  • RK a11n

    (@riaanknoetze)

    Hi there!

    That’s a great question; Out of the box, there are no settings to disable the Gutenberg styles although it’s possible using some custom coding.

    While the exact code required is a bit beyond the scope of this support forum, you’ll want to use the WordPress core function wp_dequeue_stylesheet in a Storefront child theme to remove the storefront-gutenberg-blocks stylesheet.

    For what it’s worth, I’ve also created a report for our developers to consider disabling the Gutenberg styles in cases where blocks in WordPress have been disabled. If you’re interested, check out https://github.com/woocommerce/storefront/issues/1121

    I have no idea why moderators removed my earlier post (maybe can’t link to StackOverflow?), but I will try again. Use this in functions.php of child theme:

    // Disable Gutenberg editor.
    add_filter('use_block_editor_for_post_type', '__return_false', 10);
    // Don't load Gutenberg-related stylesheets.
    add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
    function remove_block_css() {
        wp_dequeue_style( 'wp-block-library' ); // WordPress core
        wp_dequeue_style( 'wp-block-library-theme' ); // WordPress core
        wp_dequeue_style( 'wc-block-style' ); // WooCommerce
        wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
    }
    • This reply was modified 5 years, 6 months ago by taisho.
    Thread Starter Vortex11

    (@vd11)

    taisho,
    Thank you so much for this! It completely and cleanly kills Gutenberg. I’d give you a hug if I could ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How would one completely disable Gutenberg css in Storefront?’ is closed to new replies.