Fix broken sites after upgrade to WordPress 4.5

If you have just updated your WordPress to version 4.5 and some of your sites are broken or all of your animation blocks are disappeared.

Don't worry.

Before you go any further, make sure you've updated your plugins and themes to the latest versions, clear your browser's cache and cookies and re-log into your WordPress dashboard.

Most of the case, if you install Developer tool and switch to Debug mode, there is a JS error appear:

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

That is the main reason make Visual Composer plugin messed up and all of animation addons unable to work. After upgrading to WordPress 4.5, an error like the above one could appear in many themes, especially in recent premium themes. That line of code may exist is one of JS files in the theme. If you are using a premium theme, please, contact your theme author and ask for an update that fixes any instances of the jQuery problem as listed below.

Adding double quote marks before and after the hash symbol (#) will fix it.
Change this:

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

To this:

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

 

Until your theme developers release a fixed version, you can add the following code snippet into your theme functions.php file, to temporarily solve the problem:

___________________________________________________________________

add_action( 'wp_enqueue_scripts', 'load_old_jquery_fix', 100 );

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

___________________________________________________________________

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.