So I don’t know if this is possible, but I have a question – We are integrating OneTrust and one of the requirements was to change
Inside one of the plugins that we have installed on WordPress, they have their file enqueued:
wp_enqueue_script( "juicerembed', '//assets.juicer.io/embed-no-jquery.js', array('jquery'), false, false );
When the script is loaded, it loads it with no type which defaults to
<script src="https://assets.juicer.io/embed-no-jquery.js?ver=5.8.1" id='juicerembed-js'></script>.
Is there a way to hook or filter into a plugins enqueued scripts and add a type? Adding it inside the plugin directly will just get overwritten on next updates.
- Can you hook/filter possible?
- Do you deregister the script and then reregister?
All help will be appreciated!
Answer ( 1 )
There’s a filter:
This should change all the
<script>tags in the page (assuming they’re properly enqueued) to
Update: To only change the
<script>tag for the
juicerembedscript, you can do this: