Gravity Forms loading jquery

I placed the following script in my functions file to deregister WordPress jquery and use the Google CDN.

// use the Google hosted jquery library
if (!function_exists('modify_jquery')) {
    function modify_jquery() {
        if (!is_admin()) {
            wp_deregister_script('jquery');
            wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, '1.11.3', true);

            wp_enqueue_script('jquery');
        }
    }
}
add_action('init', 'modify_jquery');

I’m using Gravity Forms and it looks like on any page that has a form the jquery library is being loaded in the head section. Is this something that Gravity forms is doing? I’m just wondering how it’s able to ignore my script in the functions file. I do recall in the past that Gravity form requires jquery to load in the head and not be defered. Is this still true?

1 Answer
1

With the help of smspaulb’s link, brandozz has solved the issue by adding the following filter which defers the loading of the GravityForms script to the footer:

add_filter('gform_init_scripts_footer', '__return_true');

Leave a Comment