How can I get Contact Form 7 to not load jQuery (5 posts)

  1. dylanized
    Posted 4 years ago #

    Hi everybody, I recently started using Contact Form 7. I love it, but I don't like how it always loads jQuery.

    I'm already loading the latest, minified version of jQuery earlier in my page. I wish I could just tell CF7 to use this jQuery, instead of loading a different (older, unminified) version.

    CF7 does offer the ability to not load ALL scripts -

    But that's not what I need. I just need it to not load jQuery. Maybe in a future version there would be a WPCF7_LOAD_JQUERY flag too?

    thanks for any help!

  2. Takayuki Miyoshi
    Posted 4 years ago #

    I guess you're misunderstanding.

    • The current WordPress 3.3.1 bundles jQuery 1.7.1 (latest).
    • The bundled jQuery is already minified.
    • Contact Form 7 just loads the bundled jQuery.

    So you need nothing to do.

    Loading JavaScript and Stylesheet Only When it is Necessary

  3. dylanized
    Posted 4 years ago #

    Thank you for your clarification, you're right that CF7 is loading the minified version.

    I guess my question now is - how do I get jQuery to run earlier in the page loading process. I was loading it manually, this resulted in 2 versions of jQuery being loaded.

    Sounds like, instead I need to add an enqueue_script statement in the my head? And then CF7 will realize it already got loaded, and not reload it?

    thanks again for the help, cheers

  4. Takayuki Miyoshi
    Posted 4 years ago #

    So you don't need to load jQuery manually. Bundled jQuery is loaded automatically when necessary.

  5. Gabor Javorszky
    Posted 4 years ago #

    WordPress loads scripts with the following function:


    In case of jQuery, it would be this:

    This loads the built in jQuery bundled with WordPress. If there are two calls to this same function (such as you call it in head, or at init, and then CF7 calls it wherever it is loaded), the second time it will check whether it's already loaded, and if yes, just does nothing.

    Also, when you call jQuery, you are using the function, right?

    Also, for your reference: wp_enqueue_script

Topic Closed

This topic has been closed to new replies.

About this Topic