How do you enqueue a Visual Basic script using wp_enqueue_script?
-
16-10-2019 - |
Question
Internet Explorer will have errors with VB script files en-queued using wp_enqueue_script. This is probably because the output of enqueue script set the script type to 'language/javascript'. Are there any solutions besides manually including the VB script with the theme?
Solution
WP_Script
always adds text/javascript
to the <script>
tag, and applies no filter before it returns, there is not much you can do there. You could try to create a subclass of WP_Scripts
that has this functionality. If you change the global $wp_scripts
to your new class, this might work.
OTHER TIPS
Unfortunately script type is hardcoded in WP_Scripts
class. If you need extensive queue management for your VBS scripts you will have to extend that class and use own wrapper functions for VB separately.