Is it possible to get a script url from one of my working scripts, by handle?
So for example if i have a plugin's JS file registered with the handle wp-js-plugin and i want to get this JS file's url. how can i do that?
Is it possible to get a script url from one of my working scripts, by handle?
So for example if i have a plugin's JS file registered with the handle wp-js-plugin and i want to get this JS file's url. how can i do that?
For more info dump $wp_scripts
function get_script_src_by_handle($handle) {
global $wp_scripts;
if(in_array($handle, $wp_scripts->queue)) {
return $wp_scripts->registered[$handle]->src;
}
}
const scriptUrls = [...document.querySelectorAll('script')].map(e=>e.src)
This will list all the urls for each script.