Created
June 1, 2020 00:34
-
-
Save brunopulis/6406b324df5a7c593500b8f516687414 to your computer and use it in GitHub Desktop.
remove contact form 7 css and js to all files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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