how to remove javascript or scripts in wordpress

How to remove javascript or scripts in wordpress?

In this article we will teach you how to remove javascript or scripts in wordpress.

Some times we need to remove some javascript from our wordpress website or blog to speed up our website. Here below is a trick which you can use to remove unused js from your wordpress website.

First of all you have to find the javascript file which you want to remove and to find this open your webpage in google chrome and press ctrl+u to view the source code of the webpage, then find the script tag of js file and there you will see the id in the script tag and this is what you need to remove the js. Now paste the code given below in your functions.php file located at root_directory_path/wp-content/themes/your_theme/functions.php

And we have used here two wordpress core functions wp_dequeue_script and wp_deregister_script.

Here ‘woocommerce’ is the id of the script tag which you have found in source code of webpage.

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


add_action('wp_print_scripts', 'wra_filter_scripts', 100000);
add_action('wp_print_footer_scripts',  'wra_filter_scripts', 100000);

That’s it Now you have learned the trick how to remove javascript or scripts in wordpress.

And if you want more tutorials and tricks about wordpress then visit our WordPress Page and follow us on facebooktwittertumblrlinkdedin and if you like this article then share this.

Author: ReadyMadeCode is a website where you can find all types of codes or tutorials from popular programming languages or scripts or framework like php, laravel, html, css, javascript, nodejs, java, angularjs etc.

View All Posts From ReadyMadeCode
View Profile of ReadyMadeCode
Author Website :

Enter Your Comments Here...

16 thoughts on “How to remove javascript or scripts in wordpress?

  1. Hi there! I’m at work browsing your blog from my new apple iphone!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Keep up the fantastic work!

  2. What’s Taking place i’m new to this, I stumbled upon this I’ve discovered It positively
    useful and it has aided me out loads. I am hoping to contribute
    & help other customers like its aided me. Good job.

  3. I think this is one of the so much significant information for me.
    And i’m glad studying your article. However want to commentary on few basic things,
    The site taste is perfect, the articles is truly nice
    :D. Just right process, cheers.

  4. I feel that is among the most important info for me.

    And i’m glad studying your article. However should remark on some general things, The web site style is ideal, the articles is really great :D.
    Good job, cheers.

Enter Your Comments Here...

Scroll to top

Get Paid To Use Facebook, Twitter & Youtube

Earn From Social Media Online (Click to visit)

earn from social media online