How can I remove plugin js file from the frontside of my site using hooks :WordPress

Hello Friends!
If you do not want to load the any plugins JS file in front-end then don’t worry,you can do it using hooks without any changes in plugin files.
For Example:
If you are using “Contact Form 7” plugins in your site and don’t want to load the form7 js files on any specific page then then just add given code in your theme function file:

add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );   
function my_deregister_javascript()
{    
    if ( !is_page('Contact') )
    {     
        wp_deregister_script( 'contact-form-7' );      
    }
}

Follow same process for all plugins :)
Enjoy Code! | Raghunath Blog

Leave a Reply

Your email address will not be published. Required fields are marked *