Home > Software engineering >  Remove a script using Jquery
Remove a script using Jquery

Time:01-05

How can I disable or remove this script from loading using jquery(jQuery( document ).ready( function(){})). It is can not load in mainland of China, so makes loading extremely slow, I found the id of this element.

<script type="text/javascript" src="https://apis.google.com/js/platform.js?ver=1641328563" id="eael-google-api-js"></script>

enter image description here

CodePudding user response:

Just copy and paste the following code to your functions.php and the script should be removed.


/* Remove unwanted plugin Javascript file */
function remove_eael_google_api_js() {
    wp_dequeue_script( 'eael-google-api');
    wp_deregister_script( 'eael-google-api');
}
add_action( 'wp_enqueue_scripts', 'remove_eael_google_api_js', 100); 
  •  Tags:  
  • Related