Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load the Contact Form 7 Stylesheet and JavaScript Only When Necessary (the Right Way). See http://cfxdesign.com/load-the-contact-form-7-stylesheet-and-javascript-only-when-necessary/
<?php do_action('cf7_before_wp_head'); ?>
<?php
function remove_cf7_assets() {
if(is_front_page()) {
return;
}
add_filter('wpcf7_load_js', '__return_false');
add_filter('wpcf7_load_css', '__return_false');
}
add_action('cf7_before_wp_head', 'remove_cf7_assets');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment