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

Advertisements

Sr. Software Engineer

Tagged with: , , , ,
Posted in Wordpress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: