Title: wpcf7.initForm is not a function
Last modified: February 11, 2019

---

# wpcf7.initForm is not a function

 *  [cucumbercoolie](https://wordpress.org/support/users/cucumbercoolie/)
 * (@cucumbercoolie)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/)
 * Hi there!
 * Will there be a fix for the above error?
 * It occurs as the method is a function expression and calls initForm before it
   is declared.
 * A good post by Ben singer explains the issue in more detail [https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/](https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/)
 * Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Daniel Post](https://wordpress.org/support/users/danielpost/)
 * (@danielpost)
 * [7 years ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-11588994)
 * I am having this exact same issue. Is there a chance to get this resolved? Fixing
   it should be trivial, as explained in the post linked above.
 * Unrelated: are there any plans to move CF7 away from the jQuery dependency?
 *  [manuel_84](https://wordpress.org/support/users/manuel_84/)
 * (@manuel_84)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-11902867)
 * To fix the error I had to make the change suggested here [https://wordpress.org/support/topic/uncaught-typeerror-wpcf7-initform-is-not-a-function/](https://wordpress.org/support/topic/uncaught-typeerror-wpcf7-initform-is-not-a-function/)
   (
   moving the jQuery “on ready” function in scripts.js that calls wpcf7.initForm
   to after the initForm function is defined)
 * Please [@takayukister](https://wordpress.org/support/users/takayukister/) consider
   to add this fix, this way who is using ajax loaders (I’m using swup) with CF7
   doesn’t have issues, thanks
    -  This reply was modified 6 years, 9 months ago by [manuel_84](https://wordpress.org/support/users/manuel_84/).
 *  [lucastello](https://wordpress.org/support/users/lucastello/)
 * (@lucastello)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-11987824)
 * Hi,
    Great plugin! Please [@takayukister](https://wordpress.org/support/users/takayukister/)
   apply this simple patch. Why declaring the DOMContentLoaded event handler before
   constructing the wpcf7 object? it broke the plugin if that event was already 
   trigger…please add it to next version
 *  [theunnicked](https://wordpress.org/support/users/theunnicked/)
 * (@theunnicked)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-12516876)
 * [@takayukister](https://wordpress.org/support/users/takayukister/) any news on
   that fix? I have stumbled on this error as well
 *  [rddigital](https://wordpress.org/support/users/rddigital/)
 * (@rddigital)
 * [6 years ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-12939850)
 * [@takayukister](https://wordpress.org/support/users/takayukister/) any news on
   that fix? problem is still here. I have to replace scripts.js on every website.
   My situation is using CF7 + W3 Total Cache and deferring js. Chrome shows error,
   Firefox not.
 *  [Paco42](https://wordpress.org/support/users/pacart42/)
 * (@pacart42)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-13130986)
 * Hi, I have the same issue.
 * I found a simple fix : [https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/](https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/)
 * Could you put it in your next version please ?
 *  [stuartrobinson](https://wordpress.org/support/users/stuartrobinson/)
 * (@stuartrobinson)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-13717684)
 * Hi, same issue.
 * [https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/](https://bensinger.me/contact-form-7-fixing-wpcf7-initform-not-function-error/)
 * Would you be able to include this in a future update please?
 *  [dualpixel1](https://wordpress.org/support/users/dualpixel1/)
 * (@dualpixel1)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-13748235)
 * same on my site/template. can you fix this?
 *  [Roshan Zaid](https://wordpress.org/support/users/roshanzaid/)
 * (@roshanzaid)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-14364974)
 * was this resolved? I am having the same issue and unable to find a solution.
 *  [uzartom](https://wordpress.org/support/users/uzartom/)
 * (@uzartom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-14610563)
 * I had the same problem, so I decided to see what `console.log(wpcf7)` would give
   me. And it turned out there is no method initForm. There’s just init. Because
   of that, please try replacing `wpcf7.initForm()` with `wpcf7.init()`.
 * Hope it helps.
 *  [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-14614508)
 * I can confirm that [@uzartom](https://wordpress.org/support/users/uzartom/)’s
   solution works.
 * If you have a line of code that looks something like this:
 *     ```
       wpcf7.initForm($form);
       ```
   
 * Change it to
 *     ```
       wpcf7.init($form[0]);
       ```
   
 * The init function takes a HTMLElement, while the initForm function expected a
   jQuery object. Assuming that $form is the jQuery object representing your form(
   i.e. `$('form').eq(0)`), you can access the HTMLElement with $form[0]
 * A working example can be found here:
    [https://conditional-fields-cf7.bdwm.be/ajax-example/](https://conditional-fields-cf7.bdwm.be/ajax-example/)
    -  This reply was modified 4 years, 11 months ago by [Jules Colle](https://wordpress.org/support/users/jules-colle/).

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘wpcf7.initForm is not a function’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [contact](https://wordpress.org/support/topic-tag/contact/)
 * [form](https://wordpress.org/support/topic-tag/form/)

 * 11 replies
 * 8 participants
 * Last reply from: [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/wpcf7-initform-is-not-a-function/#post-14614508)
 * Status: not resolved