Use code PERFMATTERS for an extra 10% off!
  1. Home
  2. Docs
  3. General
  4. How to remove global inline styles in WordPress

How to remove global inline styles in WordPress

As of WordPress 5.9, additional inline code was added to improve duotone styles (CSS and SVG code). Most users probably won’t be using this feature, and the problem is that this adds 311 lines (unminified) of code to every page of your WordPress site.

  • 196 lines of CSS is added before the <body> tag.
  • 115 lines of SVG code is added before the </body> tag.

This appears to be a mistake, and we hope that this gets resolved/fixed in core. But until then, we have a simple way to remove this unnecessary code. If they do remove or change how this works, we will simply deprecate the feature.

Remove global inline styles in WordPress 5.9

Follow the steps below to remove the global inline styles in WordPress.

Step 1

Click into the Perfmatters plugin settings.

Perfmatters plugin settings
Perfmatters plugin settings

Step 2

Make sure you’re on the “General” tab.

Perfmatters General tab
Perfmatters General tab

Step 3

Under the “Options” section, scroll down and toggle on “Remove Global Styles.”

Remove global inline styles
Remove global inline styles

Step 4

Scroll down and click “Save Changes.”

We have seen a few sites that utilize global styles, so it’s always recommended to click around your site after enabling a feature just to confirm everything looks good visually.

Was this article helpful?

Related Articles