Unfortunately, sometimes plugins load Javascript and CSS files that are never used. For Mainland China, the most problematic ones are usually old Google reCaptcha Javascript files that get loaded from Google servers and therefore either slow the website down a lot or make it impossible to load the website at all.
If the file is simply not used, then you can simply go ahead and dequeue (remove) it using the code below.
In case it is used but loaded from a server that’s blocked in Mainland China, then make sure you dequeue the original link and manually add it either via custom theme or plugin.
Note that in this case, updates to the the original file won’t be automatically made on the file you load from your server, therefore, this might cause problems when updating the plugin that is using that file.
So here’s how to block the file from being loaded.
Dequeue CSS file
function dequeue_plugin_style_script(){
wp_dequeue_style( 'Style-Name' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_plugin_style_script', 999 );
Dequeue Javscript file
function dequeue_plugin_style_script(){
wp_dequeue_script( 'Script-Name-JS' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_plugin_style_script', 999 );
This should do the trick.