Hi @honoluluman,
Thanks for reaching out, and I’m glad you’re enjoying the plugin, thank you! 🙏
The issue you’re experiencing with the “wpcf7 is not defined” error typically occurs when the required JavaScript for Contact Form 7 hasn’t been loaded before it’s needed. This might be happening because the snippet is running too late in the page load process, or the way it’s being enqueued could be causing a delay in loading the necessary scripts.
Here are a couple of things you can try to resolve the issue:
- Ensure Correct Placement: Make sure that the
wpcf7_enqueue_scripts() and wpcf7_enqueue_styles() functions are placed before wp_head() in your template. These functions need to be called early to ensure the necessary scripts are loaded in time.
- Modify the Snippet Priority: Instead of setting the priority to
999, try setting it earlier (like 10). This ensures that the snippet runs before the Contact Form 7 script is needed.
- Conditional Check for CF7: If you’re using the snippet on pages where Contact Form 7 isn’t present, you could add a conditional check to ensure the scripts are only enqueued when CF7 is on the page, something like this:
if ( is_page( 'Contact' ) && function_exists( 'wpcf7_enqueue_scripts' ) ) { wpcf7_enqueue_scripts(); wpcf7_enqueue_styles(); }
This way, you’re explicitly loading the necessary scripts only on the page that contains the form.
Let me know if this helps or if you need further assistance!