Contact Form 7 Stylesheet isn't Unloaded Correctly

This was reported near the end of 2017 (here), but it is has not been fixed yet. X/Pro does not correctly remove Contact Form 7’s stylesheet, which shows up as an error in Query Monitor.

The correct way to do this is to instruct Contact Form 7 not to load the stylesheet using a filter (as is documented here).

This can be incorporated into X/Pro by making the following change in framework/functions/plugins/contact-form-7.php (I tested this):

-function x_contact_form_7_enqueue_styles() {
-  wp_deregister_style( 'contact-form-7' );
-}
-
-add_action( 'x_enqueue_styles', 'x_contact_form_7_enqueue_styles' );
+add_filter( 'wpcf7_load_css', '__return_false' );

Also note that the comment at the top of the file is incorrect, it seems the file copy-pasted from the Gravity Forms file.

Hey @amst_ws,

Thank you for your feedback. I’ll post this in our issue tracker so this will be queued for investigation by our development team.

Thanks @christian!

You are most welcome.

Hi @amst_ws,

We’ve made this adjustment for the next release. Thanks for reaching out about it.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.