jeudi 22 octobre 2015

WordPress: How can I disable Gravity Forms inclusion of jQuery?

I am including jQuery already on my website, but when using some conditional logic with Gravity Forms, it includes jQuery again, as well as its own scripts of course.

Output looks like:

<script type='text/javascript' src='//localhost:8080/wp-includes/js/jquery/jquery.js?ver=1.11.3'></script>
<script type='text/javascript' src='//localhost:8080/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/jquery.json.js?ver=1.9.14'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/gravityforms.min.js?ver=1.9.14'></script>
<script type='text/javascript' src='//localhost:8080/wp-content/plugins/gravityforms/js/conditional_logic.min.js?ver=1.9.14'></script>

What I would like to do is to keep the Gravity Form's scripts, but exclude their inclusion of jQuery and jQuery migrate. I include these myself and do not want GF to do this for me.

I have searched for the handle that includes these scripts, but cannot find the correct hook. I had the following, but it also excluded the GF scripts, which is obviously not what I want to happen:

function remove_unwanted_assets() {

    // Gravity Forms plugin.
    wp_deregister_script('jquery');

}

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

This seems to exclude everything from GF.

Any help or guidance is much appreciated. Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire