Title: Optimize JavaScript Code breaks site since update
Last modified: August 31, 2016

---

# Optimize JavaScript Code breaks site since update

 *  [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/)
 * Hi,
 * I discovered since the update that my posts had huge (arbitrary) gaps between
   them. So I set about finding the problem – and finally did.
 * When I have the option “Optimize JavaScript Code?” checked – the gaps are there–
   when I disable it, it goes away. The plugin worked great, WITH Javascript code
   enabled – AND helped my page speed, now it doesn’t and I have no idea what is
   doing what between the plugin and my theme – or if this is also something to 
   do with the new “caching” option – I already have a cache plugin –
 * Here’s an example of the site with the gap (I currently have the option disabled
   so that isn’t displaying until I can work it out)
 * Here is a screenshot of the site with the gap:
    [http://lrhcreative.com/misc-imgs/gaps.jpg](http://lrhcreative.com/misc-imgs/gaps.jpg)
 * Here is my site: [bcr8tive.com](http://bcr8tive.com/)
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 15 replies - 1 through 15 (of 34 total)

1 [2](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/2/?output_format=md)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175378)
 * sorry to read that bcr8tive.
 * have a look at [this thread about known issues, workarounds and fixes for 2.0.1](https://wordpress.org/support/topic/201-is-out-some-issues?replies=5).
   I think specifically the 2nd item is bugging you there, so try the filter from
   that thread [or download the zip-file of what will become 2.0.2](https://downloads.wordpress.org/plugin/autoptimize.zip).
 * frank
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175439)
 * Thanks Frank,
 * I will muck with it as soon as I can – will get back to you with how it goes.
 * bcr8tive
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175442)
 * super, looking forward to that; if you can confirm the zip fixes things for you
   I can push 2.0.2 out sooner rather then later 🙂
 * frank
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175534)
 * fyi: 2.0.2, based on [the current dev version](https://downloads.wordpress.org/plugin/autoptimize.zip),
   will be released shortly (today or tomorrow) with what I think will fix this 
   issues.
 * do test and if things don’t work any more holler now or be silent forever (well,
   not really, but I’d prefer to fix things before releasing to the masses).
 * frank
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175537)
 * Hi Frank,
 * Sorry I haven’t gotten a chance to beta test this yet – my Mom died and I have
   lost some time for what really seems of no consequence at the moment 🙁
 * I’ll see if I can today –
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175538)
 * Hey
 * I uninstalled the 1st version, installed the download, tested with every option
   available (in Optimize JavaScript Code and it’s the same issue – the gaps come
   back)
 * The html option as well as the CSS option works fine.
 * Without it, the error from Google Page Insights comees back:
    “Eliminate render-
   blocking JavaScript and CSS in above-the-fold content”
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175539)
 * sorry to hear about your Mom bcr8tive, I can’t imagine how hard that must be!
 * if (and only if) you feel up to it and have the time to spare, I have two follow-
   up questions;
    * is there a JS error in your browser’s (error) console? * can
   you confirm this does not happen with AO 2.0 by doing a roll-back to that version(
   download from: [https://downloads.wordpress.org/plugin/autoptimize.2.0.0.zip](https://downloads.wordpress.org/plugin/autoptimize.2.0.0.zip))?
 * if you can’t follow up on this I totally understand, AO is totally un-important
   in the bigger picture!!
 * be strong!
    frank
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175540)
 * Thank you, to be honest it’s terrible and nothing can prepare you for it 🙁
    
   Even if you lock horns with them, all of that is forgotten, everything good leaps
   out at you and you realize you can just never speak to them ever again. It really
   sucks. Who could know me better than she did.
 * Ugh anyway – sorry – I am being strong, that’s what she would say too.
 * So…
 * “* is there a JS error in your browser’s (error) console?”
 * TO my knowledge no, but how would I establish this?
 * I’m in the process now of uninstalling and trying out 2.0
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175541)
 * > Ugh anyway – sorry – I am being strong, that’s what she would say too.
 * no reason to apologize; being strong is not about having to hide or suppress 
   your grief, it’s about trying to cope with what must be immense sadness, about
   attempting to find your balance when being dealt such a major emotional blow 
   and that cannot be easy. take your time and feel free to vent your feelings if
   you feel you need to, here or elsewhere!
 * frank
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175542)
 * Ok I tried it – and oddly enough the issue remains.
 * It’s headache level now. Sigh. I’ve disabled everything else in order to insure
   150%, that the issue is what it is –
 * I read this on how some themes call Javascript in the header (and my theme hasn’t
   been updated in a few years – so no changes have been made to it)
 * “The reason you are getting render blocking message from google is because your
   javascript is being called in the header. In your wp_register_script() function
   and in your wp_enqueue_script() function you must include true for the $in_footer
   argument.”
    From: [https://wordpress.org/support/topic/eliminate-external-render-blocking-javascript-and-css-in-above-the-fold-content?replies=23](https://wordpress.org/support/topic/eliminate-external-render-blocking-javascript-and-css-in-above-the-fold-content?replies=23)
 * BUT – there is no wp_enqueue_script() or enqueue_script() in my functions.php–
   so now I’m back to disabling that option…
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175543)
 * Just saw your other message – thank you Frank – thank you for that ♥
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175544)
 * ok, there are two issues;
    1. the gaps 2. the pagespeed warning
 * regarding the gaps; I can’t access your site due to wordfence (guess you block
   non-US traffic), but [based on a webpagetest test from Dallas](http://www.webpagetest.org/result/160320_9P_TXQ/2/screen_shot/)
   you have a javascript error;
 * > Uncaught SyntaxError: Unexpected token ILLEGAL [http://bcr8tive.com/](http://bcr8tive.com/)
   > 307
 * when autoptimizing your JS, this error will very likely block all following autoptimized
   JS. try to identify/ fix what is happening there and you will _probably_ be able
   to re-enable autoptimize.
 * regarding the pagespeed warning; you actually have a rather big amount of JS 
   loaded in the head of the HTML, cfr. (again) [the webpagetest-result where request 3-15 are all for JS-files](http://www.webpagetest.org/result/160320_9P_TXQ/1/details/#request3).
   but when succeeding in getting AO to work again (and provided you don’t have 
   to “force JS in head”), your autoptimized JS will be loaded late & deferred and
   as such will not be render blocking.
 * frank
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175546)
 * I can whitelist your ip if you can provide it…
 * Unfortunately outside the U.S. has been a P.I.T.A. with the hack attempts & for
   the most part does nothing for my monetization – so (shrug)
 * I dont know how to identify that JS error as you have? But that makes sense …
 * As for the other, I’ll have to muck with the template – I love it but the developer
   hasn’t been around in like 2 years – at all. 🙁
    He also released a NEWER version–
   with improvements and that hasn’t had any updates in the same length of time ..
   haven’t found another like it that suits that site. Guess I’m going to have to
   edit it.
 *  Thread Starter [bcr8tive](https://wordpress.org/support/users/bcr8tive/)
 * (@bcr8tive)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175548)
 * Frank
 * I’ve tried to replicate the JS error you received and can’t.
 * I ran the site through [https://validator.w3.org/](https://validator.w3.org/)
   and just getting some relatively trivial formatting warnings. Not sure what it
   was or is.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/#post-7175550)
 * > I dont know how to identify that JS error as you have? […] I’ve tried to replicate
   > the JS error you received and can’t.
 * W3 validator does not report on JS errors I’m afraid. to see javascript problems,
   you should look at your browser error console (part of the “developer tools”,
   cfr. [https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors#Step_3:_Diagnosis](https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors#Step_3:_Diagnosis)
 * > I can whitelist your ip if you can provide it…
 * that would most certainly help, but I’m afraid I don’t have a fixed IP. can you
   whitelist based on country? during the daytime my IP is located in the UK (although
   I work in Brussels), after work I have a Belgian IP.
 * frank

Viewing 15 replies - 1 through 15 (of 34 total)

1 [2](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/2/?output_format=md)

The topic ‘Optimize JavaScript Code breaks site since update’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [javascript code](https://wordpress.org/support/topic-tag/javascript-code/)
 * [javascript errors](https://wordpress.org/support/topic-tag/javascript-errors/)

 * 34 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/optimize-javascript-code-breaks-site-since-update/page/3/#post-7175590)
 * Status: not resolved