Remove/Filter Duplicate Link

Hello All,

Happy New Year Everyone! I have a question.

How do you remove/filter a duplicate link from a Theme and a Plugin? I have a google map link on both theme and plugin. Now I want to use only one link, any advice or any link of a snippet to fix it.

Thank you very much!

I think you can use deregister, if you know the handle of one specific script: or simply look into your theme functions.php file and remove that link from there or relevant included files.

You can do like @GomalThemes said using the wp_deregister_script to remove the script from loading if you know the handle name. There is another hacky way of doing this using this the global $wp_scripts you will be able to access this before the wp_enqueue_script is finished executing, here you can check by regex if you want but is not recommended.


add_action( ‘wp_enqueue_scripts’, function() {
global $wp_scripts;
}, 100 );