Dequeue 'wp-global' styles in WordPress
Struggling to remove wp-global styles from your site? I recently had a case where the usual tricks did not work. Read how if managed it
30 June 2026 · Moritz Reitz
I spent way longer than I care to admit trying to remove global-styles from my WordPress frontend. The usual tricks didn't work. Every time I checked the source, it was still there. This post is the full story of what I tried, where it broke, and what actually fixed it.
What Even Is global-styles?
Since WordPress 5.9, any time you have a theme that ships a theme.json file, WordPress generates a stylesheet on the fly and enqueues it under the handle global-styles. It contains all the CSS custom properties and base styles derived from your theme's global settings — things like spacing scales, font sizes, colour palettes.
If you're running a page builder like Bricks that manages all of that itself, this stylesheet is just dead weight. It adds CSS you don't need and can cause specificity clashes with your own styles.
The Naive Approach (Doesn't Work)
My first instinct was to just throw it in with the other stylesheets I was already disabling:
function disable_stylesheets() {
wp_dequeue_style('global-styles');
wp_deregister_style('global-styles');
}
add_action('wp_enqueue_scripts', 'disable_stylesheets', 100);
Ran it. Still there. Checked the priority. Bumped it to PHP_INT_MAX. Still there.
Pitfall #1: It Gets Re-enqueued in the Footer
Here's the thing nobody tells you upfront — global-styles isn't just enqueued once. WordPress hooks wp_enqueue_global_styles() to two places:
wp_enqueue_scriptsat priority 10 (for the<head>)wp_footerat priority 1 (to catch any late registration)
So even if you successfully dequeue it on wp_enqueue_scripts, WordPress just adds it back again in the footer before the page finishes rendering. That's why my first fix appeared to do nothing — I was winning the first battle and losing the second.
Pitfall #2: PHP_INT_MAX on wp_footer Is Too Late
My next attempt was to also dequeue on wp_footer using PHP_INT_MAX so I'd run last:
add_action('wp_footer', function() {
wp_dequeue_style('global-styles');
wp_deregister_style('global-styles');
}, PHP_INT_MAX);
Still in the source. And this is the subtle one that got me.
WordPress prints footer styles via wp_print_footer_scripts() which is hooked to wp_footer at priority 20. PHP_INT_MAX is a very large number, so it runs after priority 20 — meaning the styles have already been written to the page before my dequeue even fires. I was cleaning up after the mess instead of preventing it.
The window to dequeue in the footer is between priority 1 (when it's enqueued) and priority 20 (when it's printed). Dequeuing at priority 2 would technically work, but it's fragile — any plugin that shifts those priorities would break it again.
The Fix: Remove the Action Before It Fires
The clean solution is to not fight the enqueue at all. Instead, remove the actions that cause it to be enqueued in the first place. This has to happen on init, before wp_enqueue_scripts runs:
add_action('init', function() {
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
});
That's it. Both hooks gone before they fire. No dequeue dance, no priority gymnastics.
Why init and Not Earlier?
You need to be inside the WordPress request lifecycle for remove_action to work reliably — the function you're removing needs to have been registered already. init fires after WordPress core is fully loaded, so all core hooks are in place and can be removed. Doing this at wp_enqueue_scripts priority 100 would technically also work for the first hook (since priority 10 has already run), but the footer hook would still fire.
init gives you a clean window before any of the enqueue actions run.
Where I Put It
I keep this in my child theme's functions.php alongside the rest of my stylesheet cleanup. Since global-styles needs the remove_action approach while other stylesheets work fine with a normal dequeue, I split them into two separate concerns with a comment explaining why:
// Dequeue via wp_enqueue_scripts for standard stylesheet handles
function disable_stylesheets() {
wp_dequeue_style('wp-block-library');
wp_deregister_style('wp-block-library');
wp_dequeue_style('bricks-color-palettes');
wp_deregister_style('bricks-color-palettes');
}
add_action('wp_enqueue_scripts', 'disable_stylesheets', 100);
// global-styles must be removed via init — it fires on both wp_enqueue_scripts:10
// and wp_footer:1, so dequeuing at priority 100 is too late to catch both.
add_action('init', function() {
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
});
Should You Actually Do This?
Probably, if you're running a page builder and not using block-based themes. The global-styles output can be several kilobytes of CSS variables and base styles you're not using. If your builder is generating its own design tokens, you've got two systems fighting each other.
That said — if you're using FSE (Full Site Editing) or relying on WordPress block styles at all, stripping global-styles will break things. Check your frontend carefully after applying this.
This is one of several stylesheet optimisations I apply to every WordPress build. For the complete approach — including which plugin and theme stylesheets are worth removing — read my post on dequeuing plugin stylesheets in WordPress.