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

Don't Panic!

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.

 

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

After upgrading to WordPress 4.5, an error like the above one could appear in many themes, especially in ThemeForest themes. If you are using a theme purchased on ThemeForest, 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' );
}
}

 

___________________________________________________________________

 

You can find more details in WordPress official forum: click here 

 

You can find attached to the topic the fix released for the following themes:

- Nielsen

- Mindig

- Bishop

- Regency

- Despacho

- Iris

- Panarea

- Remy

- The polygon

- Desire SexyShop

- Jalobi

- Globe

- Porto

- Kallyas

 

 

Was this article helpful?
1 out of 1 found this helpful

Back to Help Center

Powered by Zendesk