Minification and combining

HTML, CSS, JavaScript, inline, combined, and font optimization with current exclusions and defaults.

2 min readPart of Performance Optimisation

File optimisation can minify HTML, CSS, and JavaScript, combine eligible stylesheets, remove selected WordPress bloat, and host Google Fonts locally. Every transform is opt-in and can be excluded by handle or URL.

What is transformed

  • HTML: the final page buffer, with comment removal controlled separately.
  • External CSS and JavaScript: eligible enqueued assets are read, minified, written to a bounded cache, and rewritten with a stable version.
  • Inline CSS and JavaScript: included only when the corresponding setting is enabled.
  • Combined CSS: an opt-in request-reduction mode; it is not automatically better on HTTP/2 or HTTP/3.

Already-minified files, unsafe paths, builder-critical assets, and excluded handles remain untouched. The policy uses containment and randomized-query guards before writing a generated file.

Settings

KeyDefaultPurpose
minifyHTML, minifyJS, minifyCSSfalseMinify each asset family.
minifyInlineCSS, minifyInlineJSfalseProcess inline payloads.
removeHTMLCommentstrueRemove HTML comments when HTML processing runs.
combineCSSfalseCombine eligible stylesheets.
excludeJS, excludeCSS, excludeCombineCSS\'\'Keep listed handles or URLs unchanged.
hostGoogleFontsLocallyfalseFetch and serve Google Fonts locally when enabled.

The historical removeQueryStrings option is not a supported current control. Versioned asset URLs remain versioned; do not reintroduce query-string stripping as a performance shortcut.

Exclusions and recovery

Start with one asset family. If a layout or interaction breaks, identify the handle in the browser console or network panel, add that exact exclusion, save, and clear the affected page cache. For CSS that appears only after a builder update, use the CSS safelist and the used/critical CSS rollout controls instead of disabling all optimization.

Verify

wp wppo cache clear --page=/sample-page/
wp wppo cache status

Check rendered HTML, browser console, responsive layout, and a cache miss followed by a hit. A smaller file that breaks an interaction is not an optimization.