WordPress jQuery Fallback Issue

There is an issue with the WordPress jQuery fallback version that has to be fixed at the theme level. WordPress loads jQuery 1.12.4 as a fallback by default, which not only breaks a number of functions in themes but also causes a PageSpeed flag with Google.

By adding the following code to the theme functions.php file you can correct the problem.

add_filter( 'wp_enqueue_scripts', 'replace_default_jquery_with_fallback'); function replace_default_jquery_with_fallback() { $ver = '1.12.4'; wp_dequeue_script( 'jquery' ); wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', "//ajax.googleapis.com/ajax/libs/jquery/$ver/jquery.min.js", $ver, false ); wp_add_inline_script( 'jquery', 'window.jQuery||document.write(\'<script src="'.includes_url( '/js/jquery/jquery.js' ).'"><\/script>\')' ); wp_enqueue_script ( 'jquery' ); }

Hopefully we’ll see it in an update soon?

Thanks!

Hello and thank you for your suggestion,

That is against WordPress theme requirements, please check the Stylesheets and Scripts section:

TLDR:

Required to use core-bundled scripts rather than including their own version of that script. For example jQuery

Kind Regards, Roman.
aThemes Support