Skip to content

Instantly share code, notes, and snippets.

@brunopulis
Created June 1, 2020 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunopulis/6406b324df5a7c593500b8f516687414 to your computer and use it in GitHub Desktop.
Save brunopulis/6406b324df5a7c593500b8f516687414 to your computer and use it in GitHub Desktop.
remove contact form 7 css and js to all files
// remove contact form 7 from all pages, only to contact form.
function contactform7_check_dequeue() {
$check_cf7 = false;
if( is_page( 'contact' ) ) {
$check_cf7 = true;
}
if( ! $check_cf7 ) {
wp_dequeue_script( 'contact-form-7' );
wp_dequeue_style( 'contact-form-7' );
}
}
add_action( 'wp_enqueue_scripts', 'contactform7_check_dequeue', 77 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment