[wp-trac] [WordPress Trac] #44003: multiple wp_localize_script not working
WordPress Trac
noreply at wordpress.org
Tue May 8 07:59:27 UTC 2018
#44003: multiple wp_localize_script not working
---------------------------+----------------------
Reporter: gekomees | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Script Loader | Version:
Severity: normal | Resolution: invalid
Keywords: | Focuses:
---------------------------+----------------------
Changes (by ocean90):
* status: new => closed
* version: 4.9.5 =>
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
Hello @gekomees, thanks for your report.
The second argument is the "object name" which needs to be unique as it's
used as a global window variable in the form of `var phpvariables = { …
}`. A second `var phpvariables = { … }` will override the first one.
To solve this you can add the handle as a prefix to the object name:
`filtersPhpvariables` and `amaPhpvariables`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44003#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list