[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
Thu May 20 21:08:50 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 has-patch  |     Focuses:
--------------------------------------+------------------------------
Changes (by byohann6):

 * keywords:  good-first-bug needs-patch => good-first-bug has-patch


Comment:

 Hi,

 I make a patch for this issue.
 In my patch, I add an empty "$type" parameter to the
 wp_add_inline_script() function.

 If we don't specify the type parameter the function add the value
 "text/javascript" if the theme doesn't declare
 {{{
 add_theme_support( 'html5', array('script') );
 }}}

 And if we specify the type parameter, the default value is overwritten.

 This is my first patch, I'm open to discussion

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


More information about the wp-trac mailing list