Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19959 closed defect (bug) (fixed)

Fix localization issues when a plugin calls wp_enqueue_script() too early

Reported by: nacin Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: I18N Keywords:
Focuses: Cc:


Follow-up to #11526. After digging through this some more, the attached change to WP_Scripts should be just fine for all locales.

Attachments (1)

19959.diff (428 bytes) - added by nacin 4 years ago.

Download all attachments as: .zip

Change History (8)

@nacin4 years ago

comment:1 @nacin4 years ago

This doesn't work, but I bet there is a solution at hand.

comment:3 @azaozz4 years ago

Thinking it would make sense to run that action early on "init":

add_action( 'init', array( $this, 'init' ), 1 ); 

comment:4 @rfair4044 years ago

  • Cc rfair404 added

comment:5 @nacin4 years ago

Works fine with the test, but fails when nothing is attached too early. This is because we're already at the init hook by the time we try to attach something to init.

comment:6 @nacin4 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [19865]:

Wait until init to fire wp_default_scripts. Fixes localization issues when a plugin calls wp_enqueue_script() too early (in spite of the _doing_it_wrong warning signs added in #11526). fixes #19959.

comment:7 @nacin4 years ago

In [19872]:

Coverage for load-scripts.php. fixes #19959.

Note: See TracTickets for help on using tickets.