The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

How to avoid conflict with Contact Form 7 and Formidable

Labels

This Discussion is public

Notifications

I just discovered that contact form 7 was stopping my formidable registration form from working with this error popping up.

Fatal error: Call to undefined method PHPMailer::getCustomHeaders() in wp-contentpluginscontact-form-7includesmail.php on line 176

So what you can do is add the following code to your functions.php file in your child theme directory.

// Deregister Contact Form 7 JavaScript files on all pages without a form
add_action( 'wp_enqueue_scripts', 'aa_deregister_javascript', 100 );
function aa_deregister_javascript() {
    if ( ! is_page( array( 1904, 1906, 1909) ) ) {
        wp_deregister_script( 'contact-form-7' );
    }
}

Replace the numbers, ie 1904, with the page or post numbers that have the Contact Form 7 form on them.
If you have a Contact Form 7 form on every page of the website, ie in the footer, consider changing it to a formidable form.

This also has the added benefit of speeding up pages that don't require Contact Form 7!

Thanks for posting this publicly so others can benefit from it!

Discussion closed.