Created
September 19, 2017 12:38
-
-
Save emilstahl/a3fceb4cfe9d7a70909b06fcc348980e to your computer and use it in GitHub Desktop.
Remove plugin asssets on all other pages than needed
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
<?php | |
// Remove plugin asssets on all other pages than needed | |
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); | |
function my_deregister_javascript(){ | |
if(!is_page(408)){ | |
wp_deregister_script('contact-form-7'); | |
} | |
} | |
add_action( 'wp_print_styles', 'my_deregister_styles', 100 ); | |
function my_deregister_styles(){ | |
if(!is_page(408)){ | |
wp_deregister_style('contact-form-7'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment