This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 15k traffic Daily!!!

How to remove extra javascripts wordpress?


Some occasions we have to take away some javascript from our wordpress web site or weblog to hurry up our web site. Right here beneath is a trick which you need to use to take away unused js out of your wordpress web site.

To begin with it’s a must to discover the javascript file which you need to take away and to seek out this open your webpage in google chrome and press ctrl+u to view the supply code of the webpage, then discover the script tag of js file and there you will notice the id within the script tag and that is what it is advisable to take away the js. Now paste the code given beneath in your capabilities.php file situated at root_directory_path/wp-content/themes/your_theme/capabilities.php

And now we have used right here two wordpress core capabilities wp_dequeue_script and wp_deregister_script.

Right here ‘woocommerce’ is the id of the script tag which you may have present in supply code of webpage.

operate wra_filter_scripts(){

    if( is_home() == true || is_single() == true ){

        wp_deregister_script('woocommerce');
        wp_dequeue_script('woocommerce');

    }

}

add_action('wp_print_scripts', 'wra_filter_scripts', 100000);
add_action('wp_print_footer_scripts',  'wra_filter_scripts', 100000);
Enter fullscreen mode

Exit fullscreen mode


Please like share subscribe and provides constructive suggestions to inspire me to put in writing extra for you.

For extra tutorials please visit my website.

Thanks:)
Comfortable Coding:)

The Article was Inspired from tech community site.
Contact us if this is inspired from your article and we will give you credit for it for serving the community.

This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 10k Tech related traffic daily !!!

Leave a Reply

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

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?