Last active
December 20, 2015 05:19
-
-
Save scottlyttle/6077661 to your computer and use it in GitHub Desktop.
Deregister scripts and styles on pages they're not needed (WordPress)
This file contains 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
add_action( 'wp_enqueue_scripts', 'deregister_cf7_javascript', 15 ); | |
function deregister_cf7_javascript() { | |
if ( !is_page(15) ) { | |
wp_deregister_script( 'contact-form-7' ); | |
} | |
} | |
add_action( 'wp_enqueue_styles', 'deregister_cf7_styles', 15 ); | |
function deregister_cf7_styles() { | |
if ( !is_page(15) ) { | |
wp_deregister_style( 'contact-form-7' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment