Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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