[wp-trac] [WordPress Trac] #41990: wp_add_inline_script() does not print if the handler has already processed

WordPress Trac noreply at wordpress.org
Tue Sep 26 06:05:38 UTC 2017


#41990: wp_add_inline_script() does not print if the handler has already processed
--------------------------+-----------------------------
 Reporter:  satollo       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If the wp_add_inline_script() function (with 'after' position set) is
 called after the head scripts have already been printed and the handler
 specified on wp_add_inline_script() is part of the head printed scripts,
 the code is not added later in the footer.

 Probably it should. Example a plugin which implements a shortcode needs to
 add some jquery inline statement only when the shortcode is executed (to
 add the js code only on relevant pages). It enqueues jquery to be added in
 the footer and a piece of inline script.

 But another plugin or the theme enqueues jquery in the header (as many
 do): the above inline code is not printed but it actually does not need to
 be exactly after the jquery inclusion.

 Stefano.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41990>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list