[wp-trac] [WordPress Trac] #25280: wp_localize_script unexpectedly convert numbers to strings

WordPress Trac noreply at wordpress.org
Tue Jan 14 20:57:18 UTC 2014


#25280: wp_localize_script unexpectedly convert numbers to strings
-------------------------------------------------+-------------------------
 Reporter:  adamsilverstein                      |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  I18N                                 |  Review
 Severity:  normal                               |     Version:  3.2
 Keywords:  has-patch dev-feedback needs-        |  Resolution:
  testing                                        |
-------------------------------------------------+-------------------------

Comment (by tomauger):

 I'm liking this fix, but actually agree with adam that it might be good to
 have an entirely new way of passing object dependencies into  our JS.
 Right now I'm using a lot of JSDoc to document the "localize" global JS
 var, but it certainly would be nice to have something a little more
 robust.

 Forking wp_localize_script() to wp_pass_vars_to_script() (for lack of a
 better name) seems like a pretty good (and backward-compatible) way to go.

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


More information about the wp-trac mailing list