Viewing 6 replies - 1 through 6 (of 6 total)
  • Bug and you are using incorrect code in the functions.php file. If the Enqueue safe version of jQuery checkbox is still displayed and it is enabled please disable it and then click on the Save All Changes button.

    Then in the functions.php file of your child theme change your code to look like this (perhaps best to do a copy\paste):

    function mytheme_jquery_script() {
    	wp_deregister_script( 'jquery' );
    	wp_deregister_script( 'jquery-core' );
    
    	wp_register_script( 'jquery', 'ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', array(), '2.1.4', false);
    	wp_enqueue_script( 'jquery' );
    }
    
    add_action( 'wp_enqueue_scripts', 'mytheme_jquery_script');

    If you already have a method\function being added as an action to the wp_enqueue_scripts hook in the theme functions.php file you can add all lines starting with wp_ at the end of that method\function. The rest is then obsolete (because it is probably already there).

    This should fix it.

    In the Enqueue safe version of jQuery setting click on the ‘click here to check again.’ link to obtain the JQuery version being used and then refresh the iTSec plugin Settings page. It should now report in green:

    Your current jQuery version is 2.1.4.

    If the above info helped you solve the issue please mark this topic as ‘resolved’.

    dwinden

    Thread Starter Teddy_c

    (@teddy_c)

    Awesome, it worked perfectly.

    Thank you! Do you think you could explain me what happened?

    Thread Starter Teddy_c

    (@teddy_c)

    Just a little note for anyone having the same issue, instead of writing:

    “ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js”

    write:

    https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js”

    Thanks again Dwinden

    Actually change that to:

    //ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js

    This way it will work scheme independent.

    An overall explanation of what happened with jQuery in your env follows later on.

    dwinden

    So here is the explanation.

    First you need to understand that the Enqueue safe version of jQuery setting is supposed to only display a checkbox when:

    1. It detects a vulnerable jQuery version (<1.6.3) …
    2. The Enqueue safe version of jQuery setting is not yet enabled.

    This means once enabled there will be no checkbox available to disable it … (it can be disabled by manually editing options in the database using phpMyAdmin).

    However due to a bug the setting will also display the checkbox when no jQuery version info is detected\available (bug) … in this situation the checkbox will remain displayed whether enabled or not.
    Luckily this also allowed us to easily disable the setting again. So disabling the setting was step 1 to resolving your issue.

    Then we needed to fix 2 issues in the enqueue code added to the functions.php file:

    1. Specify the jQuery version when enqueueing the custom jQuery release. This is crucial for proper functioning of the Enqueue safe version of jQuery setting.

    2. Switch from using the init hook to using the wp_enqueue_scripts hook for enqueueing the custom jQuery script.

    With the custom jQuery version info available the Enqueue safe version of jQuery setting was now able to properly determin that the jQuery version enqueued (2.1.4) is not vulnerable.

    dwinden

    Thread Starter Teddy_c

    (@teddy_c)

    Thank you very much for the explanation! Really helpful

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem loading jQuery hosted library’ is closed to new replies.