پلاگین رایگان وردپرس

WordPress 4.5 , jQuery 1.12 , broken plugins and themes!

Hi Guys,
you just upgraded your WordPress to new version 4.5 and bomb! some plugins stop working,what’s problem ?

mentioned problem affected to plugins like:

  • Visual Composer ( to fix upgrade to 4.11.2+)
  • quform
  • divi
  • and…

related js error:

  • Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])
  • Uncaught Error: Syntax error, unrecognized expression: a[href=#scroll-top
  • and…

first of all i must say that this is not WordPress related issue while this is a JavaScript and jQuery issue and you may to update your plugins and themes to the latest ones.
if the updates does not work so you must make your hands dirty with some code changes.

you may read these links about wp 4.5 and jquery issue:

https://github.com/jquery/jquery/issues/2824

https://wordpress.org/support/topic/read-this-first-wordpress-45-master-list

http://shinephp.com/wordpress-4-5-jquery-1-12-compatibility-issues/

all this problems comes from a little # sign!

and all works you must to do is to convert selector codes by below samples:

[code]$(a[href=#id]) TO $(a[href="#id"])[/code] [code]$(a[href^=#]) TO $(a[href^="#"])[/code] [code]$(a[href*=#]) TO $(a[href*="#"])[/code] [code]$('a[href=#scroll-top]') TO $('a[href="#scroll-top"]')[/code]

But if you can not fix problem or there was any update to fix?

easy way : you must hire a WordPress expert!

and one dirty way! just copy and paste below code in your theme functions.php file:

[code lang="php"]
function fix_jquery_1_12_issue() {
//both for admin and users
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', false, '1.11.1');
wp_enqueue_script('jquery');
}
add_action('init', 'fix_jquery_1_12_issue');

[/code]

you can make this as a plugin also

hope to be useful. 🙂