[wp-trac] [WordPress Trac] #51124: Can we get an additional parameter in wp_add_inline_script to set the script type?

WordPress Trac noreply at wordpress.org
Sat Jan 30 16:25:59 UTC 2021


#51124: Can we get an additional parameter in wp_add_inline_script to set the
script type?
----------------------------------------+------------------------------
 Reporter:  hcabrera                    |       Owner:  (none)
     Type:  feature request             |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Script Loader               |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  good-first-bug needs-patch  |     Focuses:
----------------------------------------+------------------------------

Comment (by GeekPress):

 > Also, given that the text/javascript is the default for scripts, having
 type="text/javascript" there is not needed, and the latest W3 validation
 tool actually returns a warning for it with "The type attribute is
 unnecessary for JavaScript resources."

 Hi @Otto42

 The `type="text/javascript"` is removed if we set `script` to the HTML5
 theme support


 {{{
 add_theme_support( 'html5', [ 'script' ] );
 }}}

 Are you suggesting to totally remove by default `type="text/javascript"`?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51124#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list