Hi Rs,
just dequeue the ‘global-styles’ style using wp_dequeue_style
Also…
I’ve just updated a site which doesn’t use Gutenberg to 5.9
Unless you’ve taken steps to actually disable the block editor (aka Gutenberg) completely, then you’re using Gutenberg by default. You don’t need to use the Gutenberg plugin to use Gutenberg, and merely using another page builder plugin does not necessarily disable Gutenberg.
Thread Starter
RS
(@rsdotscot)
@thedock much appreciated. I’ll give it a bash.
@gappiah I’ve only been using WP for 18 years across countless installations at this point, but thanks for talking to me like I’m a complete novice. FYI I hate page builders and this site uses the classic editor.
Thread Starter
RS
(@rsdotscot)
@thedock I’ve tried adding an action to wp_enqueue_scripts, wp_footer, and even wp_print_styles, but no luck so far. Any ideas?
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'global-styles-inline-css' );
wp_deregister_style( 'global-styles-inline-css' );
}, 100000 );
you don’t need to include the ‘inline-css’ suffix, that’s added by WP since the style is inline enqueued with the function wp_add_inline_style().
wp_dequeue_style( ‘global-styles’ );
should do it.
-
This reply was modified 4 years ago by
thedock.
Thread Starter
RS
(@rsdotscot)
@thedock that did the trick, thanks 🙂
This is not solving the problem in my case.
Global inline styles are always there.
I did that in my child theme:
/**
* Remove global script
*/
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'global-styles' );
wp_deregister_style( 'global-styles' );
}, PHP_INT_MAX );
I also have tried with the inline suffix, but it didn’t work.
I got a solution
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
see
https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/
Unfortunately, none of these are working for me. Very annoying. @gik000 is it still working for you with the latest WP update?
Try this
add_action( 'init',function(){
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
} );