What Autoptimize does on your site
Autoptimize is a front-end code optimization plugin published by Optimizing Matters. It intercepts each page’s HTML before it is sent, minifies the CSS, JavaScript and HTML, can combine files, and by default defers JavaScript so it no longer blocks rendering. The optimized files are stored in /wp-content/cache/autoptimize/ and served as static files.
Around that core sit four settings tabs: “JS, CSS & HTML”, “Images” (lazy loading, on-the-fly optimization through ShortPixel’s CDN, WebP and AVIF), “Critical CSS” and “Extra” (Google Fonts, emojis, block CSS, preconnect, preload). The key point: Autoptimize does not do page caching. Its own FAQ recommends pairing it with a caching plugin or your host’s cache.
The plugin is free. Autoptimize Pro, a subscription sold on the vendor’s site, adds page caching, near-unlimited image optimization and CDN delivery through ShortPixel, automatically generated critical CSS rules, “Boosters” (delaying JavaScript, iframes or parts of the HTML until the visitor interacts) and a setup wizard.
Which sites Autoptimize suits best
- Sites that already have a page cache (from the host, WP Super Cache or Cloudflare) and want leaner CSS and JavaScript without switching tools.
- Blogs and brochure sites whose theme loads lots of scripts: deferring JavaScript by default often speeds up the first render.
- Developers comfortable with code, who get exclusions,
noptimizetags and plenty of filters to tune optimization per site.
It is the wrong pick if you want an all-in-one fix for a site with no cache at all: a plugin like WP Rocket bundles caching and optimization. On a LiteSpeed server, LiteSpeed Cache already handles minification. Turn each optimization on in one plugin only, or you risk broken pages and server errors, as Autoptimize’s FAQ warns.
Autoptimize strengths and limits
Strengths
- Cautious defaults. JavaScript is minified and deferred without combining, CSS is minified, and cart and checkout pages are left alone.
- Plays well with most caches. It only rewrites code, and it clears its own cache when some caching plugins purge theirs.
- Highly configurable. Exclusions by file or code snippet, per-post and per-page settings, and hooks for developers.
- 404 fallbacks. If a cached page requests an optimized file that was deleted, backup CSS or JS limits the damage.
Limits
- No page caching in the free version. You need another plugin, your host’s cache, or Pro.
- External services for images and critical CSS. Image optimization runs through ShortPixel with a quota, and automatic critical CSS needs a paid key or Pro.
- A cache that can balloon. The plugin never purges its cache on its own, and aggregating inline JS or CSS makes it grow fast.
- Things can break. Combining, deferring and exclusions need testing, especially with page builders or jQuery-heavy themes.
The Autoptimize settings we recommend
You will find everything under Settings > Autoptimize. Change one setting at a time, click “Save Changes and Empty Cache”, clear your page cache too, then test in a private window. Judge the result on Core Web Vitals, not on a single score.
| Setting | Recommended value | Why |
|---|---|---|
| Optimize JavaScript Code? Settings > Autoptimize > JS, CSS & HTML | On, with “Do not aggregate but defer?” | That is the default on new installs: minified, non-blocking JS without one giant file. |
| Aggregate JS-files? and Aggregate CSS-files? Same tab | Off unless you measure a gain | With HTTP/2 the vendor no longer turns them on by default, and combining breaks scripts more often. |
| Also aggregate inline JS? Same tab | Off | The FAQ advises against it because it makes the cache grow very quickly. |
| Optimize CSS Code? and Optimize HTML Code? Same tab | On | Real gain, low risk; check the layout after enabling them. |
| Eliminate render-blocking CSS? Same tab | Only with reliable critical CSS | Without matching critical CSS, the page flashes unstyled for a moment. |
| Also optimize shop cart/ checkout? Same tab, Misc Options | Off (default) | The FAQ says to turn it off if checkout or payment stops working. |
| Also optimize for logged in editors/ administrators? Same tab, Misc Options | Off if you use a page builder | The FAQ recommends this for Visual Composer, Beaver Builder and similar builders. |
| Enable 404 fallbacks? Same tab, Misc Options | On (default) | Prevents an unstyled page when a page cache requests a deleted file. |
| Lazy-load images? Settings > Autoptimize > Images | On, sparing the first images | Set “Lazy-load from nth image” so the hero image is not delayed, and do not enable lazy loading in another plugin as well. |
- Compare a page with and without
?ao_noptimize=1appended to the URL: the difference shows what Autoptimize changes. - Test a form, the mobile menu, the cart and the cookie banner after every change.
- Make sure no other plugin already minifies CSS, JavaScript or HTML.
- Keep an eye on the cache size shown in the “JS, CSS & HTML” tab: steady growth points to code that changes on every page.
Autoptimize vulnerabilities and the version to run
Autoptimize rewrites the HTML of every page, so an escaping mistake can turn into an XSS vulnerability. The recent fixes worth knowing:
- CVE-2026-3220, fixed in 3.1.15: unauthenticated stored XSS caused by the predictable placeholder used during HTML minification; other plugins shipping the same library were affected too.
- CVE-2026-2430, fixed in 3.1.15: a Contributor could inject script through the attributes of lazy-loaded images.
- CVE-2026-14995 and CVE-2026-78471, fixed in 3.1.16: unauthenticated XSS, the first when critical CSS is active with an API key, the second under rarer conditions tied to image lazy loading.
- CVE-2021-24377, fixed in 2.7.8: a race condition in the settings import allowed code execution from an administrator account.
Run the latest version (3.1.17 also hardens Google Fonts optimization) and turn on automatic updates, following our guide to automatic plugin updates. WP Feint Pro strips the HTML comments Autoptimize can leave in your pages (see removing the HTML comments that give WordPress away), which makes the plugin harder for bots to spot, without replacing updates; Pro also renames the /wp-content/cache/autoptimize/ folder, but the autoptimize_* file names stay visible.
What WP Feint hides for Autoptimize
Pro Handled by WP Feint Pro only
The free version does not know the traces specific to Autoptimize: without Pro, only generator tags are removed, as for any plugin.
Free version
Handled by WP Feint Pro only
With Pro
- signed HTML comments
- folder name
- tag IDs
- generated-file folders
Still visible
- file names
autoptimize_*.css, autoptimize_*.js
These traces stay because the plugin needs them to work (scripts, styles, cookies) or because they come from the server.
Autoptimize FAQ
Does Autoptimize replace a caching plugin?
No, the free version does not cache pages. Pair it with your host’s cache or a caching plugin whose minification you switch off. Autoptimize Pro adds page caching.
My site looks broken after activation. What now?
Turn off JavaScript optimization alone, then CSS optimization, to find the culprit. Then exclude the offending file under “Exclude scripts from Autoptimize:” and clear both the Autoptimize cache and your page cache.
Why does the Autoptimize cache keep growing?
The plugin does not purge its cache by itself, so it won’t break pages still cached elsewhere. Fast growth almost always comes from aggregated inline code: turn off aggregation of inline JS and CSS.
Does image optimization work on a protected site?
No. ShortPixel’s service must be able to download your images, so a local site, password protection, a firewall or hotlink protection will block it.