Quantcast
Channel: WordPress.org Forums » [Autoptimize] Support
Viewing all articles
Browse latest Browse all 14038

Frank Goossens on "[Plugin: Autoptimize] Inline script Tags Not Optimized"

$
0
0

evening Jamie;
inline script with "nonce" or "post_id" in it gets automatically excluded from optimization, to avoid the "random" strings in them to break the autoptimize's cache. in your case I indeed see;

"update_shipping_method_nonce":"534f904eea"

(and there's a nonce in the other inline JS block as well) Not excluding that from optimization would result in AO having to re-aggregate & -minify the JS for the cart-page every time the nonce changes, slowing things down & leading to a huge amount of cached JS.

there are four approaches you can take to fix the page;
1. force JS into head
2. exclude jquery.js from optimization
3. use the API to disable AO on /cart/ (see example code in autoptimize_helper.php_example)
4. make a small change to your footer template, adding a "js insert marker" and using the API to tell AO to insert JS at that marker instead of before the closing body tag (again see example code in autoptimize_helper.php_example)

hope this helps,
frank


Viewing all articles
Browse latest Browse all 14038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>