I have Gutenberg plugin installed in WordPress v4.9.8 and am trying to remove the CSS that comes with it so I can supply my own.
This is the sheet that gets included:
<link rel='stylesheet' id='wp-block-library-css' href='/wp-content/plugins/gutenberg/build/block-library/style.css?ver=1535795173' type='text/css' media='all' />
I have tried the following:
add_action( 'wp_print_styles', 'wps_deregister_styles', 100 ); function wps_deregister_styles() { wp_dequeue_style( 'wp-block-library-css' ); wp_deregister_style( 'wp-block-library-css' ); }
As well as variations of this, but the file persists. How can I remove it?
Upon activation, you need to visit Settings » Disable Gutenberg page to configure plugin settings. By default, the plugin will disable Gutenberg everywhere for all users on your website. However, if you want to limit it to certain user roles and post types, then you need to uncheck the 'Complete Disable' option.
Use Both Editors at First – Under Settings>Writing, there is the option to 'allow users to switch editors”. Assuming you have both editors installed, you can turn this option on and ease yourself into the Gutenberg experience by using it alongside the classic editor.
I'm adding this as a more complete answer than my comment:
You need to remove the -css
when trying to dequeue the script. That's added to the HTML markup and not the actual tag for the css file.
If you search the code (the location of the enqueue may change as Gutenberg gets rolled into core), you can find:
wp_enqueue_style( 'wp-block-library' );
As you can see, there is no -css
. This solution may work for other plugins that people have trouble dequeuing styles.
Edit: Since this still gets some traction, here is the code to handle it:
add_action( 'wp_print_styles', 'wps_deregister_styles', 100 ); function wps_deregister_styles() { wp_dequeue_style( 'wp-block-library' ); }
I am use this code to to remove default style.
//Disable gutenberg style in Front function wps_deregister_styles() { wp_dequeue_style( 'wp-block-library' ); } add_action( 'wp_print_styles', 'wps_deregister_styles', 100 );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With