wpcf7 is not defined | WordPress.org

[ad_1]

What other plugins and theme do you use on the site?

This is the current list of active plugins, all on the lastest versions, theme is custom developed:

ActiveCampaign Postmark

Advanced Custom Fields Multilingual

Advanced Custom Fields PRO

Contact Form 7

Contact Form 7 Extension For Mailchimp

Contact Form 7 Multilingual

Contact Form CFDB7

GDPR Cookie Compliance

Git UpdaterVersion

Safe SVG

Transients ManagerVersion

WPML Media Translation

WPML Multilingual CMS

WPML SEO

WPML String Translation

Yoast SEOVersion

Yoast SEO Premium

Anyways, i did a bit of testing, disabled all the plugins and got a same result on the same theme, when i switched the theme to default wp theme it seems like index.js is loaded correctly and validation is working, so it’s safe bet that some part of our custom code functionality causes this error, any idea which change from 5.9.8 to 6.0 would cause this error so i can troubleshoot our code further? This is currently the way we echo form in php:

  <?php if (!is_admin() && isset($form) && $form) : ?>
  <?= do_shortcode('[contact-form-7 id="' . $form->ID . '" title="' . $form->post_title . '"]'); ?>
  <?php endif; ?>

The issue was in this piece of code defering wpcf7 js files on the load, so probably that was the reason wpcf7 was declared as undefined:

add_filter( ‘script_loader_tag’, function ($tag, $handle, $src) {
if(!is_admin()) {
$tag = ”.”\n”;
}
return $tag;
}, 10, 3 );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer