Skip to content

Instantly share code, notes, and snippets.

@emilstahl
Created September 19, 2017 12:38
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 emilstahl/a3fceb4cfe9d7a70909b06fcc348980e to your computer and use it in GitHub Desktop.
Save emilstahl/a3fceb4cfe9d7a70909b06fcc348980e to your computer and use it in GitHub Desktop.
Remove plugin asssets on all other pages than needed
<?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