Autoptimize can help improve your site’s performance, but in some cases after installing and activating you might encounter issues with your site. Although frustrating and maybe even scary, these problems can generally be easily resolved by re-configuring Autoptimize and I’ll be happy to share how you can do that.
First off: if the problem is limited to just one (or two) page(s), go to that page’s edit screen and in the “Autoptimize this page” metabox simply disable “optimize this page” and forget about it (or if you want to be more specific you candisable just “optimize JS” or “optimize CSS” or “lazyload images” or …).
If the problem is more widespread, then try to identify what is breaking things by just disabling CSS or JS or HTML or Image optimization (incl. lazyload). Keep in mind you might have to clear your page cache after a configuration change (depending on your setup this might be a page caching plugin or on the server or at host level or at a 3rd party such as Sucuri or Cloudflare).
If the problem goes away by disabling CSS optimization, reactivate it and
- If “aggregate CSS” and “also aggregate Inline CSS” are on, first try disabling “also aggregate inline CSS” and if still broken try also disabling “aggregate CSS”
- Try adding wp-content/themes to exclude the theme CSS from being optimized
- Try adding wp-content/plugins to exclude all plugins CSS from being optimized, if that works you can try narrowing it down further by excluding specific plugins e.g. wp-content/plugins/elementor
If the problem goes away by disabling JS optimization, reactivate it and
- If you see “jQuery is not defined“-errors on the browser console, make sure
wp-includes/js/jquery/jquery.min.js is not aggregated (add it to the JS optimization exclusion field) or asynced/ deferred in any way.
- If “aggregate JS” is active, try switching to “don’t aggregate but defer”, optionally with “also defer inline JS” on as well (in which case you can likely remove at least the default exclusions).
- Try adding wp-content/themes to exclude the theme JS from being optimized
- Try adding wp-content/plugins to exclude all plugins JS from being optimized, if that works you can try narrowing it down further by excluding specific plugins e.g. wp-content/plugins/elementor (example in screenshot above: koko to exclude all Koko Analytics JS)
Image optimization or lazyload issues can be fixed by excluding the image(s) from those optimizations by either excluding (part) of the image path (e.g.
wp-content/uploads/2022/10/whatever.jpg) or if the <img tag has a e.g. class attribute excluding by class-name (e.g.
If the problem is with HTML minification, just keep that off, it’s not very important. Obviously, if you have some of the options on the “Extra” tab active, try deactivating them one by one.
If all of the above fails, there is always free quality support offered over on the wordpress.org Autoptimize support forums! 🙂