Fix broken sites after upgrade to WordPress 4.5

I bet you have just updated your WordPress to new version 4.5 and some part of your sites are broken or all of your animation blocks are not appeared anymore. You don't know what is the reason and don't know how to handle this issue? So, here is the solution:

First, I need you make sure your plugins and themes have updated to the latest versions. Log out of current administrator session, clear your browser's cache  and log back into your WordPress admin panel.

Most of the case, if you have installed Developer tool, switch to Debug mode, then this JS error will appear:

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

That is the main reason make Visual Composer plugin messed up and all of animation addons unable to work. After upgraded to WordPress 4.5 version, an error like the this may appear in lots of WordPress themes, especially in recent premium themes. That line of code may exist is one of JS files in the theme. If you're using a premium theme, just contact your theme author and require for an update pack that could fixes the jQuery problem like this.

Adding a coulpe of double quote marks ( " ) before and after the hash symbol ( # ) will fix it.

I mean, try to replace this:

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

With this:

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

 

Until your theme author could provide a patch to fix this issue, you can add the following code snippet to the functions.php file of your theme, it will temporarily solve the problem:

/*==== Code ====*/add_action( 'wp_enqueue_scripts', 'load_old_jquery_fix', 10 );

function load_old_jquery_fix() {
    if ( ! is_admin() ) {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" ), false, '1.11.3' );
        wp_enqueue_script( 'jquery' );
    }
}
/*==== End Code ====*/

This means, we actually replace current jQuery version with the older one. And with this version, you will not face any other trouble with JS conflict in WordPress 4.5.

These solutions may fix almost all of the cases I have done, so, hope it works for you. If you have any question, please leave me a message.

 

/*=== Fix broken sites after upgrade to WordPress 4.5 === */