Title: Bug: wpcf7 JQuery Not Defined Error
Last modified: February 10, 2022

---

# Bug: wpcf7 JQuery Not Defined Error

 *  Resolved [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
 * (@thomasjarvisdesign)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/)
 * Since upgrading the site to WordPress 5.9
 * When using the solution below to only load JS and CSS on pages with contact forms:
   
   [https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/](https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/)
 * I am seeing a console error on all contact form pages
 * [https://www.thinkjarvis.co.uk/contact/](https://www.thinkjarvis.co.uk/contact/)
 * wpcf7 JQuery Not Defined Error. Showing in the Console:
    /wp-content/plugins/
   contact-form-7/includes/js/index.js?ver=5.5.4
 * Please can you advise?
 * I Have Honeypot for CF7 and Flamingo installed. Disabling these plugins makes
   no difference
 * Code added to contact template file:
 *     ```
       if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
               wpcf7_enqueue_scripts();
           }
   
           if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
               wpcf7_enqueue_styles();
           }
       ```
   
 * Code added to functions.php in child theme:
 *     ```
       // Disable Contact Form 7 Unless Called
       add_filter( 'wpcf7_load_js', '__return_false' );
       add_filter( 'wpcf7_load_css', '__return_false' );
       ```
   
    -  This topic was modified 4 years, 4 months ago by [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/).
      Reason: More detail added for debug
    -  This topic was modified 4 years, 4 months ago by [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/).
    -  This topic was modified 4 years, 4 months ago by [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-wpcf7-jquery-not-defined-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
 * (@thomasjarvisdesign)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15350845)
 * This problem was also reported here without a solution:
    [https://wordpress.org/support/topic/js-error-wpcf7-is-not-defined/](https://wordpress.org/support/topic/js-error-wpcf7-is-not-defined/)
   The issue is the same. But without the Multistep plugin enabled.
 *  Thread Starter [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
 * (@thomasjarvisdesign)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15351051)
 * This solution works: But if you can provide an update to the documentation on
   the website it would br really appreciated.
 * ‘function contactform7_dequeue_scripts() {
    $check_cf7 = false;
 *  if( is_page(‘contact’) ) {
    $check_cf7 = true; }
 *  if( !$check_cf7 ) {
    wp_dequeue_script( ‘contact-form-7’ ); wp_dequeue_style(‘
   contact-form-7’ ); } } add_action( ‘wp_enqueue_scripts’, ‘contactform7_dequeue_scripts’,
   77 );’
 *  [ScreenRes](https://wordpress.org/support/users/screenres/)
 * (@screenres)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15471793)
 * I was having the same issue, thanks for the fix [@thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
 *  Thread Starter [thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
 * (@thomasjarvisdesign)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15471984)
 * [@screenres](https://wordpress.org/support/users/screenres/) No problem. Feel
   sorry for me I had to roll this fix out to 60 websites manually….
 * YOu can change the if is page to an array if you want to include multiple pages.
 * I also added dequeue for contact form 7 conditional fields plugin.
 *     ```
       // Function to enable CF7 on certain pages
       function contactform7_dequeue_scripts() {
           $check_cf7 = false;
   
           if( is_page ( array ('contact', 'contact-us', 'pre-booking-form') ) ) {
               $check_cf7 = true;
           }
   
           if( !$check_cf7 ) {
               wp_dequeue_script( 'contact-form-7' );
               wp_dequeue_style( 'contact-form-7' );
               wp_dequeue_script( 'wpcf7cf-scripts' );
               wp_dequeue_style( 'cf7cf-style' );
           }
       }
       add_action( 'wp_enqueue_scripts', 'contactform7_dequeue_scripts', 77 );
       ```
   
 *  [ScreenRes](https://wordpress.org/support/users/screenres/)
 * (@screenres)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15472581)
 * [@thomasjarvisdesign](https://wordpress.org/support/users/thomasjarvisdesign/)
   60 sites!
    Thankfully I haven’t got that many to update. CF7 Condition Fields
   still worked fine for me with the standard method but suppose I should keep it
   all neat in one call in one place. Thanks for the updated.

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

The topic ‘Bug: wpcf7 JQuery Not Defined Error’ 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

 * [contactform7](https://wordpress.org/support/topic-tag/contactform7/)

 * 5 replies
 * 2 participants
 * Last reply from: [ScreenRes](https://wordpress.org/support/users/screenres/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/bug-wpcf7-jquery-not-defined-error/#post-15472581)
 * Status: resolved