Skip to content

Instantly share code, notes, and snippets.

@ajskelton
Created March 23, 2014 12:08
Show Gist options
  • Save ajskelton/9722236 to your computer and use it in GitHub Desktop.
Save ajskelton/9722236 to your computer and use it in GitHub Desktop.
Contact Form 7 - Removes the loading of CF7 files on every page, and only on the "Contact" page.
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
if ( !is_page('Contact') ) {
wp_deregister_script( 'contact-form-7' );
}
}
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
if ( !is_page('Contact') ) {
wp_deregister_style( 'contact-form-7' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment