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

Open Divi Social Media Icons in a New Tab

Ensuring your website's social media icons open in a new browser tab creates a seamless user experience and keeps visitors engaged with your site while allowing them to explore your social media presence. This approach prevents users from navigating away from your...

Set Hover Color for Menu Links in the Divi Menu Module

Customizing the hover color of menu links lets you enhance the user experience and maintain visual consistency with your website’s brand. By setting a specific hover color, you can guide visitors' attention and improve navigation feedback. In this guide we show you...

Enable Automatic Looping for YouTube Videos in the Divi Video Module

Enabling automatic looping for YouTube videos in your Divi video module ensures that content plays seamlessly and continuously without interruption. This feature can enhance user engagement, highlight key information, or create dynamic visual effects on your website....

Hide Video Controls in Divi Video Module

Disabling YouTube video controls in the Divi Video Module helps create a seamless, distraction-free viewing experience for your site visitors. This approach is useful when you want full control over how your video content appears and is interacted with on the page, or...

Mute YouTube Videos by Default in the Divi Video Module

In the Divi Video Module, starting your YouTube videos muted by default can create a more user-friendly browsing experience on your webpage. It is particularly beneficial for reducing distractions, enhancing visitor engagement, and providing a seamless content preview...

Random Divi Posts