[wp-trac] [WordPress Trac] #33471: wp_enqueue_style() doesn't register it in parallel wp_enqueue_scripts

WordPress Trac noreply at wordpress.org
Wed Sep 23 20:36:01 UTC 2015


#33471: wp_enqueue_style() doesn't register it in parallel wp_enqueue_scripts
--------------------------+----------------------
 Reporter:  Looimaster    |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by Frank Klein):

 * status:  reopened => closed
 * resolution:   => invalid


Comment:

 Enqueued scripts are indeed registered. But in the sample code provided,
 the call to `wp_add_inline_style()` happens in a function that is hooked
 before the function enqueuing the script that you want to add the inline
 styles to.

 This means that the inline styles can't be added, because at the moment at
 which you want to add them, the script handle doesn't exist yet, because
 that function is called later.

 If you use priorities to ensure that `my_scripts()` is called before
 `my_scripts2()`, then the code will work.

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


More information about the wp-trac mailing list