WordPress 4.5 , jQuery 1.12 , broken plugins and themes!

1 امتیاز2 امتیاز3 امتیاز4 امتیاز5 امتیاز 5 امتیاز
Loading...

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:

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

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:

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');

you can make this as a plugin also

hope to be useful. 🙂

بخوانید:  آسان ترین راه تعویض دامین در هنگام اضطرار!
سفارش پلاگین وردپرس

نظرات شما را پذیراییم

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

*

*

Time limit is exhausted. Please reload CAPTCHA.