Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Speed & performance · Info

Autoptimize Plugin Settings Explained: What Each Option Does

Autoptimize Plugin Settings Explained: What Each Option Does

Short answer

Autoptimize settings control how the plugin minifies, combines and defers your JavaScript, CSS and HTML, plus lazy loading, Google Fonts and CDN options. A safe start is to minify CSS and HTML and defer JavaScript without aggregation, then clear caches and test key pages.

Key takeaways

  • Autoptimize optimises code but does not cache full pages.
  • Defer JavaScript without aggregation is the safest JS setup.
  • Aggregating inline CSS or JS can bloat the cache.
  • Exclude any script that breaks rather than disabling everything.
  • Do not run two plugins that minify the same files.
  • Clear the Autoptimize cache and page cache after every change.

What do Autoptimize plugin settings control?

Autoptimize settings control how the plugin minifies, combines and delays your site's JavaScript, CSS and HTML, plus optional image, font and CDN tweaks spread across several tabs.

The plugin does not cache full pages. It rewrites the code that WordPress outputs, so it works best next to a page cache plugin or a host-level cache.

You find the settings under Settings > Autoptimize after you install the free plugin from the Autoptimize page on WordPress.org. The main tabs are JS, CSS & HTML, Images, Critical CSS, and Extra.

Before you change anything, take a backup and open your homepage in a private window so you can compare the result. If you are new to speed work, our guide to eliminating render-blocking resources explains why these options matter.

Which JavaScript options does Autoptimize have?

The JavaScript section lets you minify scripts, combine them into one file, defer them, exclude specific files, and wrap code in try-catch blocks to limit breakage.

Optimize JavaScript Code is the master switch. When it is off, nothing else in this section runs.

Aggregate JS-files combines your theme and plugin scripts into a single file. On HTTP/2 hosting, combining is less useful than it used to be, and it is the option most likely to break sliders, menus and forms.

Also aggregate inline JS pulls small script blocks from the page into the combined file. Leave it off unless you know you need it, because inline code often changes per page and bloats the cache.

Do not aggregate but defer is the safer modern choice. It keeps scripts as separate files but loads them with the defer attribute, so they no longer block rendering. MDN's script element reference explains what defer does in the browser.

Also defer inline JS works with the previous option. It delays inline script blocks too, which can fix errors where inline code runs before jQuery has loaded.

Exclude scripts from Autoptimize takes a comma-separated list of file names or partial paths. Add any script that breaks after optimisation, such as payment or reCAPTCHA scripts.

Add try-catch wrapping wraps each script so one error does not stop the rest. It can hide problems, so use it only as a stopgap while you find the faulty script.

Which CSS options does Autoptimize have?

The CSS section can minify stylesheets, combine them, inline small background images, and load styles in a non-blocking way using critical CSS.

Optimize CSS Code turns CSS processing on. Minifying CSS is low risk and usually worth enabling.

Aggregate CSS-files combines stylesheets into one file. It reduces requests but means one change anywhere creates a new large file, so test it on your real pages.

Also aggregate inline CSS moves style blocks from the page into the combined file. Page builders print a lot of inline CSS, so this can create many cache files.

Generate data: URIs for images embeds small background images directly into the CSS. It saves requests but makes the CSS larger, so the gain is small on most sites.

Inline and Defer CSS places a small block of critical CSS in the page head and loads the full stylesheet later. You need good critical CSS for this, or you will see a flash of unstyled content.

Inline all CSS puts every style rule into the HTML. It removes the CSS request but stops browsers caching your styles between pages, so it rarely helps.

Exclude CSS from Autoptimize works like the JavaScript exclusion box. Add stylesheets that must load unchanged.

For a wider look at trimming styles, see our guide on how to remove unused CSS in WordPress.

What do the HTML and CDN options do?

The HTML option strips whitespace from page markup, and the CDN Base URL field rewrites asset links so optimised files load from your CDN instead of your server.

Optimize HTML Code removes spaces and line breaks. The saving is usually small after server compression, but it is safe on most themes.

Keep HTML comments stops Autoptimize removing comments. Some plugins rely on comments as markers, so tick it if a feature breaks after HTML minification.

CDN Base URL only matters if you use a pull CDN with its own hostname. If your CDN works at the DNS level, such as a proxied Cloudflare setup, leave it empty.

Our guide on setting up a CDN for WordPress explains which type of CDN you have.

What are the cache and misc settings?

The cache info and misc options show where optimised files are stored and decide whether excluded files are still minified, whether 404 fallbacks are used, and whether logged-in users see optimised pages.

The Cache Info box shows the cache folder, whether it is writable, and how many files and how much space are in use. A cache that grows without limit usually points to inline code being aggregated.

Save aggregated script/css as static files writes plain files rather than PHP-served ones. Keep it on unless your host has an unusual setup.

Minify excluded CSS and JS files still minifies files you excluded from combining. It is generally safe.

Enable 404 fallbacks serves a fallback file if a page cache points to an optimised file that no longer exists. It helps when page and Autoptimize caches get out of sync.

Also optimize for logged in editors/administrators applies optimisation while you are logged in. Turn it on while testing so you see the same thing as visitors.

The toolbar entry lets you clear the Autoptimize cache from the admin bar. Clear it, then clear your page cache, any time you change settings.

What do the Images, Critical CSS and Extra tabs do?

The Images tab handles lazy loading and optional image optimisation, Critical CSS connects to a paid service, and Extra removes emojis, handles Google Fonts and adds preconnect hints.

TabMain optionsSafe to start with?
JS, CSS & HTMLMinify, aggregate, defer, exclusionsMinify CSS/HTML and defer JS first
ImagesLazy-load images, image optimisation via a third-party serviceLazy load yes; optimisation is optional
Critical CSSAutomatic critical CSS with an API keyOnly if you use Inline and Defer CSS
ExtraGoogle Fonts, remove emojis, query strings, preconnect, async JSRemove emojis and preconnect are low risk

On the Images tab, lazy loading delays offscreen images. WordPress already adds native lazy loading to many images, so check you are not doubling up with another plugin. Our lazy loading guide covers this.

The image optimisation option sends images through an external service for compression and modern formats. Check the current terms and limits on the plugin page before relying on it.

On the Extra tab, the Google Fonts setting can leave fonts alone, remove them, combine them, or load them asynchronously. Removing fonts changes your design, so test before saving.

Remove emojis stops WordPress loading its emoji script and style. It is a common small win.

Remove query strings from static resources strips version numbers from file links. It rarely helps speed and can cause stale files after updates, so most people leave it off.

Preconnect to 3rd party domains adds early connection hints for services such as font or analytics hosts.

What settings should most sites start with?

Most sites should enable CSS and HTML minification and defer JavaScript without aggregation, then test key pages before trying anything more aggressive.

A sensible order looks like this:

  1. Turn on Optimize CSS Code and Optimize HTML Code.
  2. Turn on Optimize JavaScript Code with Do not aggregate but defer, plus Also defer inline JS.
  3. Clear the Autoptimize cache and your page cache.
  4. Test the homepage, a post, a form, the cart and checkout if you run a store.
  5. Run PageSpeed Insights again to compare.

If something breaks, add the failing script to the exclusion box rather than turning everything off. The browser console usually names the file that threw the error.

Google's guide to render-blocking resources explains the metric these settings aim to improve.

Can Autoptimize conflict with other plugins?

Yes, Autoptimize can conflict with other optimisation plugins, page builders and checkout scripts, mainly when two tools minify or delay the same files.

If you run WP Rocket, LiteSpeed Cache or W3 Total Cache, turn off their file optimisation features or Autoptimize's, not both at once. Doubling up often causes broken layouts and JavaScript errors.

Page builders such as Elementor load many scripts and inline styles. Defer usually works, but aggregation of inline CSS can produce a cache that keeps growing.

If a fix is not obvious, follow our plugin conflict guide to isolate the cause. You can also ask on the plugin's support forum, where the developer often replies.

How do you undo bad Autoptimize settings?

Untick the option you last changed, clear the Autoptimize cache, then clear any page cache and your browser cache before testing again.

If you cannot reach the admin area, you can add the query string ao_noptimize=1 to a page URL to view it without Autoptimize. That lets you confirm the plugin is the cause.

As a last resort, rename the plugin folder over FTP or your host's file manager to deactivate it. Your settings stay in the database, so you can reactivate and fix them afterwards.

Frequently asked questions

Does Autoptimize replace a caching plugin?

No. Autoptimize rewrites JavaScript, CSS and HTML but does not store full pages. Pair it with a page cache plugin or your host's server cache to get the full speed benefit, and turn off overlapping file optimisation in the other plugin.

Should I aggregate JS files in Autoptimize?

Usually not on modern HTTP/2 hosting. Aggregation is the option most likely to break menus, sliders and forms. Deferring scripts without aggregating them gives most of the benefit with far less risk, so start there and only try aggregation if testing shows a clear gain.

Why does my Autoptimize cache keep growing?

The cache usually grows because inline JavaScript or inline CSS is being aggregated, and that inline code changes on every page or visit. Turn off the options to also aggregate inline JS and inline CSS, then clear the cache and watch whether it stays stable.

Is Autoptimize free?

The core plugin is free on WordPress.org and includes all the JavaScript, CSS, HTML and Extra options. Some features, such as automated critical CSS and image optimisation, rely on third-party services that may have their own limits or paid plans.

How do I see a page without Autoptimize?

Add the ao_noptimize query parameter set to 1 to the end of the page address. The page then loads without Autoptimize changes, which helps you confirm whether a layout or script problem is caused by the plugin.

Sources

  1. Autoptimize WordPress.org Plugin Directory
  2. Autoptimize support forum WordPress.org
  3. The script element MDN Web Docs
  4. Eliminate render-blocking resources Chrome for Developers
  5. Autoptimize settings guide Kinsta

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.