Fix Divi Sliders and Images not Working with WP 4.5

Written by Dan Mossop

You may find that certain Divi Theme features stop working correctly when you upgrade to WordPress 4.5. For instance you may find that your sliders don't slide, or your images don't show. This post explains how to solve it.

What's the problem?

The problem is that older versions of Divi used a common, but incorrect, bit of jQuery code. This code, found at (approximately) line 706 of Divi's js/custom.js, file reads:

$( 'a[href*=#]:not([href=#])' ).click( function() {

The code incorrectly has no quotation marks around the hash (#) symbols. Until now this was not a problem as the jQuery library happily overlooked this slight mistake.

WordPress 4.5, however, now loads an updated version of the jQuery library which is not so generous. The library, on seeing the code above triggers a JavaScript error, like so:

To see if you're affected by this, load your site in Google Chrome and then click ctrl-shift-j to bring up the JavaScript console. If you're affected above, you'll see the message:

Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])

This JavaScript error has the knock-on effect of stopping Divi's other JavaScript code from running, which it needs to animate your sliders, load your images, etc.

How can I fix it

The simplest way to fix this is to update to the Divi 2.7.3 (or later), as Elegant Themes have fixed the issue in this version.

If for some reason you are unable to update, you can manually fix the issue by modifying the affected line in js/custom.js to read:

$( 'a[href*="#"]:not([href="#"])' ).click( function() {

While it's not normally advisable to edit Divi's core files as they will be overridden by updates, in this case it is okay as a subsequent update will apply Elegant Themes' fix and remove the need for your manual edit.

Resolve Divi Theme Issues in Minutes!

Easily enhance your Divi site with Divi Booster. This powerful plugin offers hundreds of new features that can fix common issues and streamline your workflow when dealing with WordPress updates.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

0 Comments

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.

Latest From Divi Booster

How to Add the Post Status in Divi's Dynamic Content

Divi's Dynamic Content feature is great for enhancing your post/page templates with post-specific information. While Divi includes an option to show information such as the Post Created Date using Dynamic Content, there is no equivalent option for the Post Status....

Fix Divi Text Module "Regular" Font Weight Not Working

Are you encountering an issue where the font weights in Divi's Text Module don't seem to apply as expected? In particular, you might find that when you set the text module's body text font weight to "Regular", your font is actually assigned a weight of 500 instead of...

Make the Divi Gallery Module Swipeable

The Divi Gallery Module comes with a slider mode that lets you display images in a slider with clickable left/right arrows to scroll through the images. For mobile / touchscreen users, you can improve the user experience by allowing your user to swipe to navigate to...

How to Use Divi Dynamic Content in Woo Modules Product Selector

Divi's Dynamic Content is a powerful feature that lets you populate your Divi modules and theme builder templates with data pulled in various sources, such as custom fields. This allows for efficient organization and maintenance of your sites.Unfortunately, Divi's...

Random Divi Posts