that’s because you’re using lab.js (probably via https://ww.wp.xz.cn/plugins/wp-deferred-javascripts/) which results in jquery not being available when the autoptimize JS loads.
2 solutions;
* either disable (or reconfigure) wp deferred JS to make sure jquery is not deferred
* remove js/jquery/jquery.js from AO’s JS optimization exclusions (test your site, some plugins/ themes require jquery to be available early)
hope this helps,
frank
Hello Frank
Thanks
I have tried to exclude from AO’s JS optimization exclusions lab.js, js/jquery/jquery.js
But there is no change. Next i have try to add this code to wp-deferred-javascripts plugin
// Don’t defer this script.
add_filter( ‘do_not_defer’, ‘exclude_canvas_script’ );
function exclude_canvas_script( $do_not_defer ) {
$do_not_defer[] = ‘js/jquery/jquery.js’;
return $do_not_defer;
}
I have try also with code snipped plugin adding this code above but i didn’t have luck.
I don’t know what i m doing wrong. need more help
Thanks
Damjan
start disabling “wp deferred js” to confirm if this is the problem and if it is you might have more luck contacting the developer of that plugin, as I don’t know that plugin and hence can’t comment on your code snippet?
frank
I have disabled the plugin wp deferred but this issue is still remaining if i disable Autoptimize the issue i gone and i also have problem with Removing render-blocking JavaScript is there another solution to defer or asynchronously load blocking JavaScript?
Thanks
Damjan
well, just had a quick look and there is no “jQuery is not defined” error any more even though AO is active, so clearly something is working? 😉