Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load the Contact Form 7 Stylesheet and JavaScript Only When Necessary (the Right Way). See
<?php do_action('cf7_before_wp_head'); ?>
function remove_cf7_assets() {
if(is_front_page()) {
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